1

I did a git fetch origin on my repository. I was interested in developing on a remote branch named search-analytics

In the command's output I see

+ 5c2e2aa...e9ad142 search-analytics -> origin/search-analytics  (forced update)

What does (forced update) mean here? This doesn't come on any of the other branches.

devnull
  • 118,548
  • 33
  • 236
  • 227
Apurv
  • 4,458
  • 2
  • 21
  • 31

2 Answers2

2

This means that the remove branch (origin/search-analytics) was updated in a way that undoes some of the commits you have already pulled from it. In other words, the previous version of it you were working upon has not just been updated (i.e., more commits were added on top of it), but one or more of them were removed/redone.

Mureinik
  • 297,002
  • 52
  • 306
  • 350
1

I think that line means that someone performed a force push, a force push occurs like so:

# Change example.file
git add example.file
git commit example.file -m "I'm commiting this file"
git push origin search-analytics
# Realize you screwed something up and don't want anyone to see it
# Change example.file again, or any file really
git add example.file
git commit --amend
# Amends the previous commit, as if the changes you just made, 
#                                        were originally in it
git push origin search-analytics
# The push fails because you amended a commit you already pushed
git push origin search-analytics --force

If you're having trouble merging after a force (ie you pulled in between the pushes), here is an explanation of how to reset your branch (pretty much the only solution)

Community
  • 1
  • 1
Tom Prats
  • 7,364
  • 9
  • 47
  • 77