New to git (through my new job) and being instructed to "just do a pull before you commit", I did so. Much to my surprise, all changes in my working directory disappeared.
Thanks.
The command git pull
is effectively an alias for git fetch
and git merge
. Whoever was instructing you probably did a poor job, because git pull
right before you commit will indeed wipe out all your work. What they should have told you to do instead was commit, then git pull
, or if you don't want a merge history use git pull --rebase
instead. After that you can git push
.
I don't believe there is any way to get back your un-committed work if it was overwritten by a merge initiated by git pull
, unfortunately.
Also as a not-super-related friendly reminder, make sure every time before you start working on a new commit you git pull
to get any commits anyone else has been working on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With