I want to pull changes from specified branch to my local repository, but I don't wont it to merge with master branch. What is the right way to do that? Do I have to make my own branch and than pull?
Asked
Active
Viewed 2.5k times
7
-
2This is what `git fetch` is for. – user229044 Apr 03 '18 at 18:03
-
I think you may be muddling terminology: "pull" in git means "fetch + merge". Where do you want the changes to show up? In your working copy so you can view them? In a graph view? – IMSoP Apr 03 '18 at 18:03
-
@IMSoP In my working copy – user3568043 Apr 03 '18 at 18:24
1 Answers
17
git pull
is the same as git fetch
followed by git merge
.
To create a local branch tracking a branch on a remote, first fetch from the remote and then run git checkout
with the name of a branch that matches that on the remote:
git fetch <remote>
git checkout <branch>
<remote>
is the name of the remote, for instanceorigin
.<branch>
is the name of a branch on that remote. Ifgit branch -r
shows a branch nameorigin/foo
, Git should set this up correctly if you dogit checkout foo
.

jsageryd
- 4,234
- 21
- 34