Skip to main content

Timeline for Git pull after forced update

Current License: CC BY-SA 4.0

8 events
when toggle format what by license comment
Dec 28, 2021 at 10:27 comment added herman @NeilTraft Indeed that is why the accepted answer includes rebasing in interactive mode. This is also possible in case off pulling with rebase, so I've updated my answer. Reset is not necessary (it is one of the two options in the accepted answer).
Dec 28, 2021 at 10:26 history edited herman CC BY-SA 4.0
extended answer for removed commits
Dec 23, 2021 at 23:48 comment added Neil Traft I haven't investigated, but I think this will only work correctly if only new commits have been added—rather than old commits being removed or changed. (Say, if one branch was rebased onto another, or the ordering of commits were changed.) Otherwise, you will end up re-adding the removed commits. I think that is the reason for needing git reset.
Dec 23, 2021 at 23:48 comment added Neil Traft If the current branch is not tracking the remote branch as its "upstream", then you will need to manually specify which branch you want to pull from: git pull --rebase origin <branch-name>.
Nov 10, 2021 at 10:33 comment added praty Thank you! This worked for me when I rebased my feature branch on master, force pushed it and then git pull --rebase d it on another machine.
Nov 4, 2020 at 10:40 comment added Dr_Zaszuś This is much simpler than git reset origin/master --hard or git rebase origin/master especially if there are no local commits. Thanks!
May 28, 2020 at 7:25 comment added herman I use this all the time to get the latest code from master into my feature branch without having all those merge commits in the history.
May 28, 2020 at 7:23 history answered herman CC BY-SA 4.0