Vishal Patoliya ツ
Vishal Patoliya ツ

Reputation: 3238

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:

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 !

Upvotes: 1

Views: 2823

Answers (3)

Abderraouf.MERAZKA
Abderraouf.MERAZKA

Reputation: 27

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

Upvotes: 1

Amit
Amit

Reputation: 32376

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.

Upvotes: 1

Aashutosh jha
Aashutosh jha

Reputation: 628

You can use git rebase

git fetch origin
git rebase origin/master

Upvotes: 1

Related Questions