Reputation: 5612
I have master and develop branch.
In develop branch I have commit1.
Question:
How to add changes from commit1(develop) to master branch as local changes (uncomitted changes)?
Upvotes: 1
Views: 118
Reputation: 20246
Most common workflow in git is to just continue working on a branch until you feature is finish or bug is fixed and then merge it back into its parent branch (in your case master).
However, if you do want to bring changes from one branch over into the other, you have a few options.
git merge
command as Landys mentioned. Either --no-commit
or --squash
will bring changes from another branch over without actually committing them. You'll probably need to do a git reset
to unstage the changes that you just merged in. This will bring all the changes from all of the commits over.git checkout
to specify a specific file you want to check out from another branch or use patch mode (-p
) to select which changes you want to check out from the other branch and which you don't.git cherry-pick
to bring that commit over and then git reset HEAD~
to undo the commit cherry-pick
made but not modify the files in your working directory.Upvotes: 0
Reputation: 7727
Use git merge
in master
branch.
git merge develop
If you want to merge without commit
, just add --no-commit
and --no-ff
.
git merge develop --no-commit --no-ff
Upvotes: 1