Reputation: 3366
Assume that I have 4 branches
Master Branch
Branch 1
Branch 2
Branch 3
I am currently in Branch 3 and I want to get all the files from Branch 2 to Branch 3 without committing the files to Master branch.
Is that possible?
Upvotes: 4
Views: 111
Reputation: 1324606
You could either:
merge branch2 to branch3
git checkout branch3
git merge branch2
or, depending on what you need, force branch3 to become branch2
git checkout branch2
git branch -f branch3 branch2
git checkout branch3
(that would replace the history of branch3 by the one of branch2)
In both cases, commits on master would be unchanged.
Upvotes: 2
Reputation: 56
It will record the merging history in your branch3.
`git checkout <branch 3>
git merge <branch 2>`
Option 2 - Fetch the files you want into branch3
git checkout <branch 3>
git checkout <branch> -- path/to/files
Upvotes: 2