简体   繁体   中英

Git pull master in local branch which is not merge in master

I have an local branch say my_local , I have commits few changes & push to server but still not merge with master branch . Now I have few more changes to push from same branch but I wanted to do pull & merge with master.

I simply follow:

  • stash my local changes &
  • Pull origin master

But this is showing all master-branch new changes as modified in my local branch. What is wrong in that, anything I'm missing ?

Please suggest !

You can use git rebase

git fetch origin
git rebase origin/master

This is very common scenario. you do follow below steps:-

  1. stash changes in your current branch using git stash .
  2. Switch to master branch . git checkout master .
  3. pull latest changes of master. git pull origin master .
  4. change to your local branch . git checkout your_local_branch .
  5. pop your saved changes in your local branch. git stash pop .
  6. you might get merge conflict at this stage, resolve them.
  7. commit your changes whether there is any conflict or not, it will be marked as merge commit.

Hope these steps are clear and let me know if you need any other info.

  1. git pull origin master
  2. git checkout my_local
  3. git rebase master

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM