I am working on a branch called create
. I have to pull the changes that are made into my branch. I already have done -
git checkout master
git pull origin master
and now I have to merge it. What's the way to merge it?
Considering that you have updated the master
on your local using
git checkout master && git pull origin master
You can pull the changes to create
branch also using -
git checkout create && git pull origin master
Edit - As suggested by @Zarwan, rebase is also another option. For details on when to use which, please look into When do you use git rebase instead of git merge?
It is recommended to rebase your feature branch with master rather than merge it. Details below
rebase - if you are still working on your feature branch create
, then rebase your feature branch to master
. This allows you to work on your branch with the latest version of master
as if you've just branched off your master.
git checkout create
git rebase master
merge - use it when you finish your task on your feature branch and want to merge it to other branches. For example, when you finish your work on create
branch and want to merge it with master
.
git checkout master
git merge create
git push origin master
This operation also generates a merge commit on your master
branch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With