I need to git pull
all branches from a remote repository, but I want to exclude one particular branch. This is my attempt, based on what I read at https://git-scm.com/docs/git-pull , looking at the part, on excluding branches:
$ git ls-remote | grep Bad-branch
From git@gitlab.mycompany.com:analytics/path/repo.git
181647289762f00110d67199adec2559a5dbbbe6 refs/heads/Bad-branch
$ git pull origin ^refs/heads/Bad-branch
There are no candidates for merging among the refs that you just fetched.
Generally this means that you provided a wildcard refspec which had no
matches on the remote end.
That is not working, as you can see. How can I specify a branch to exclude?
I also referenced these posts, but I don't want to modify a config file, just a temporary command line specification to ignore the branch until it is removed.
- Is there a way to git ignore entire branches?
- How to ignore some branches/tags being copied to local git when do git fetch --all
EDIT: For clarity, here is the actual git call that breaks, because I'm on Windows and the path name that gets generated from the branch name gives a filename that is too long:
$ git pull
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Total 3 (delta 2), reused 3 (delta 2), pack-reused 0
Unpacking objects: 100% (3/3), 384 bytes | 16.00 KiB/s, done.
error: cannot lock ref 'refs/remotes/origin/TCCFOUR-19049-Algo-ProductionModuleLowDeltaT.R-distribution.supply.temperature.in.control.exception-displayed-as-YesNo-in-RDR-but-TrueFalse-in-analytic': Unable to create 'C:/Users/IRINZN/work/projects/analytic-r-docker-setup/analytic-r-cc4-algorithms/.git/refs/remotes/origin/TCCFOUR-19049-Algo-ProductionModuleLowDeltaT.R-distribution.supply.temperature.in.control.exception-displayed-as-YesNo-in-RDR-but-TrueFalse-in-analytic.lock': Filename too long