You haven't fetched them into your remote-tracking branch yet), which Update 3: You can also use the -force-with-lease option as a "safer" forceįorce pushing with a "lease" allows the force push to fail if thereĪre new commits on the remote that you didn't expect (technically, if In the end the commit history will look much better: D'-E' topic This will require me to resolve any conflicts like before, but for each step instead of committing I'll use git rebase -continue. So probably the best option is to do a git pull -rebase. It might look enticing to use git pull -force but be careful because that'll leave you with stranded commits: D-E topic Here I could fix the conflicts and commit, but that would leave me with a really ugly commit history: C-D-E-F topic Say I've cloned your repo and have added a few commits like so: D-E topicīut later the development branch is hit with a rebase, which will cause me to receive an error like so when I run git pull: Unpacking objects: 100% (3/3), done.Īutomatic merge failed fix conflicts and then commit the result. Update 2: Because of the increasing number of viewers I'd like to add some additional information on what to do when your upstream does experience a force push. Just let other developers know this will happen periodically so they'll know what to expect. If you are creating changes that others will review, then it's not uncommon to create a branch with those changes and rebase periodically to keep them up-to-date with the main development branch. And if they have any local commits after the point of change they will become invalid. Just be warned, if other people are sharing this repository their revision history will conflict with the new one. Leaving off and will force push all local branches that have set -set-upstream. You should be able to force your local revision to the remote repo by using git push -f
0 Comments
Leave a Reply. |