0

I get this message after I pull an updated version from the remote repository, The number goes up by one every time.

The problem appears to be that git creates a new commit for each pull request which just records in the local repository that I have pulled a new version and git status implies that I should then push this back to the remote. There doesn't seem to be any value in recording this action back in the remote so I was wondering if there was any way of avoiding this.

One suggestion I came across in a post from 6 years ago is to run git pull --rebase. There was a warning that this could potentially produce trouble for times ahead. Anyway I gave it a try when git status was showing that I was 6 commits ahead and it removed the commits message. Should I always use git pull --rebase instead of git pull for all future updates? Alternatively is there now a way of configuring git to avoid these warnings about being ahead of the remote?

Mikec
  • 1
  • 3

1 Answers1

0

If you are pushing your local changes into remote then you must not face this issue.With rebase you say to use another branch as the new base for your work.

Before using rebase you must keep following points in mind:

  1. Is the branch you are getting changes from shared with other developers outside your team (e.g. open source, public)? If so, don't rebase. Rebase destroys the branch and those developers will have broken/inconsistent repositories unless they use git pull --rebase.

  2. Rebase is a destructive operation. That means, if you do not apply it correctly, you could lose committed work and/or break the consistency of other developer's repositories.

  3. Might you want to revert the merge for any reason? Reverting (as in undoing) a rebase is considerably difficult and/or impossible (if the rebase had conflicts) compared to reverting a merge. If you think there is a chance you will want to revert then use merge.