1

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?

Steve Waters
  • 3,348
  • 9
  • 54
  • 94

1 Answers1

1

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--(snip 510 commis)--D <<< origin/develop

After you pulled develop :

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

After you merged it into feature-branch :

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

and finally when you'll have pushed :

A---B-------------------------E <<< feature-branch, origin/feature-branch
     \                       /
      C--(snip 510 commis)--D <<< develop, origin/develop
Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
  • Yeah so basically that amount of commits is included in that "merge" commit which just show as a "merge develop to feature/... " including that heck-ton of changes in it in the repository? – Steve Waters Apr 01 '19 at 09:04
  • 1
    Yes, in a way. They're not really "included" in that merge, but since E makes that long list of commits reachable, it's a good enough metaphor. – Romain Valeri Apr 01 '19 at 09:15