Hello,
If you are not on master branch, you can invoke this to get back to
master:
$ git checkout master
If you want to get rid of some commits that you have done on top of the
master branch, first you have to know what is the status. That's what I
get while having 1 commit on top of master:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Then, you can do:
$ git reset --hard HEAD~1
If you have more commits on top of master, use that number instead of 1
in the above command.
After that, this is what I see:
$ git status
On branch master
Your branch is up to date with 'origin/master'.
To update to the latest master from git, you can invoke:
$ ./g pull -r
Regards,
Hossein
On 28.07.2024 10:25, Laurent Balland wrote:
Hi,
I've got a push tree since several years, and it changed its behavior
a few weeks ago:
git reset --hard origin/master
now preserve my changes. Which option should I use to discard all my
changes?
Thanks
Laurent
--
Hossein Nourikhah, Ph.D., Developer Community Architect
Tel: +49 30 5557992-65 | Email: hossein@xxxxxxxxxxxxxxx
The Document Foundation, Winterfeldtstraße 52, 10781 Berlin, DE
Gemeinnützige rechtsfähige Stiftung des bürgerlichen Rechts
Legal details: https://www.documentfoundation.org/imprint