@𝓒𝓱𝓻𝓲𝓼
If you’ve made a change, there are several options.
If you don’t mind the change – in other words, if it can be discarded – simply discard it with
If the change is important to you, use
With
you save your modified file and temporarily remove it from the working directory.
will then run and fetch the latest version of the file. You can then retrieve your modified version using
However, this will cause the changes made to the newly fetched file to be lost, which may not be what you want.
If you’ve made a change, there are several options.
If you don’t mind the change – in other words, if it can be discarded – simply discard it with
git restore <file>If the change is important to you, use
stash:With
git stashyou save your modified file and temporarily remove it from the working directory.
git pullwill then run and fetch the latest version of the file. You can then retrieve your modified version using
git stash popHowever, this will cause the changes made to the newly fetched file to be lost, which may not be what you want.