简体   繁体   中英

What does this git output (forced update) mean?

In the following scenario I am working on a private feature branch, which I only push in order to make it available between my own different machines. But both develop and master, as one might expect, are shared branches, and their integrity is important. When I saw this output, which I'm fairly certain is different from what I normally see, I was sort of terrified. Did I somehow also force changes to be pushed to those other two branches (in which case I need to notify others fairly quickly), and not just the branch I was working in? And if not, what is this output meant to indicate?

maurice@debian:~/a_project$ git push -f
[...]
 + e3d41a7...e71be58 feature/policies-redesign -> feature/policies-redesign (forced update)
 + 3fa3bf8...9142dea master -> master (forced update)
 + a01ab9a...8403461 release -> release (forced update)

As @miqid mentioned in comments, the documentation for git-push says:

Note that --force applies to all the refs that are pushed, hence using it with push.default set to matching or with multiple push destinations configured with remote.*.push may overwrite refs other than the current branch (including local refs that are strictly behind their remote counterpart). To force a push to only one branch, use a + in front of the refspec to push (eg git push origin +master to force a push to the master branch). See the <refspec>... section above for details.

The relevant lines in ~/.gitconfig from my work machine that made it behave differently from my home machine:

[push]
  default = current

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM