sync branch with another branch 1

sync branch with another branch

// Main/ master branch.
$ git add .
$ git status                       // to see what changes are going to be commited
$ git commit -m 'Some descriptive commit message'
$ git push origin 

// Branch that you want to sync with main/ master branch.
$ git checkout      // go to  that is ment to be synced with 
$ git rebase               // bring  up to date with 
$ git push origin  // commit the changes
$ git checkout             // return to 

Here is what the above code is Doing:
1. git checkout
– Checkout the branch you want to merge into.
2. git pull origin
– Pull any changes from the remote branch.
3. git checkout
– Checkout the branch you want to merge from.
4. git rebase
– Rebase the branch you are on onto the checked out branch.
5. git checkout
– Checkout the branch you want to merge into again.
6. git merge
– Merge the other branch into the checked out branch.
7. git push origin
– Push the changes to the remote branch.

Similar Posts