Steve Waters
Steve Waters

Reputation: 3548

Local Commits after merging

I was working on a feature branch (let's call it DEV-1234), not yet made any changes, came back to work after a few days break and of course the develop branch had a huge amount of changes in it which I wanted to merge to my feature branch so as to start working with the latest version of the code.

So, I did this:

git checkout develop
git pull 
git checkout feature/DEV-1234
git merge develop

Now, as I check git status on that branch, I get this:

$ git status
On branch feature/DEV-1234
Your branch is ahead of 'origin/feature/DEV-1234' by 503 commits.
(use "git push" to publish your local commits)

I don't have any local commits though. Or does that merge count as a local commit? What actually happens if I make git push in this branch as it suggests?

Upvotes: 1

Views: 901

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 21938

If you now push your branch, you'll update the remote version of the branch, who currently has the ref before the merge with the newest commits.

It's not necessary, though, you might as well work on it for now and push only when you deem it ready for the pull request.

Initial state :

A---B <<< develop, feature-branch, origin/feature-branch
     \
      C----(510 commits)----D <<< origin/develop

After you pulled develop :

A---B <<< feature-branch, origin/feature-branch
     \
      C----(510 commits)----D <<< develop, origin/develop

After you merged it into feature-branch :

      origin/feature-branch
     /
A---B-------------------------E <<< feature-branch
     \                       /
      C----(510 commits)----D <<< develop, origin/develop

and finally when you'll have pushed :

A---B-------------------------E <<< feature-branch, origin/feature-branch
     \                       /
      C----(510 commits)----D <<< develop, origin/develop

Upvotes: 1

Related Questions