undefinedfix
Sign in

The problem of backoff after git pull

user9532756 edited in Mon, 16 Jan 2023

All the processing methods seen on the Internet are get reset -- hard, but if used in this way, the premise is that there is no local modified content.

If there are uncommitted codes locally, is there a way to cancel the code pulled and keep the local changes? As far as I know, get reset -- soft will keep the code from pulling.

Of course, it seems that there is no problem in using soft to keep the code pulled over? But there will be conflicts when pulling again.

6 Replies
dlectronique
commented on Mon, 16 Jan 2023

For a local modification that has not been added, if pull succeeds (pull with local modification often fails directly), then the local modification should not have been added.

At this time, GIT stash can be temporarily stored, and then fallback. After fallback, GIT stash pop can be restored.

amrobx
commented on Mon, 16 Jan 2023

There is an opportunistic method. If you open the editor, you can directly use Ctrl Z to solve it

yfjip
commented on Mon, 16 Jan 2023

I don't quite understand your question. Can you draw a picture to describe it?

sepulchre
commented on Mon, 16 Jan 2023

You can use the GIT stash command.

jdrover
commented on Mon, 16 Jan 2023

If you have uncommitted code locally, you can store it temporarily.

Loresone
commented on Mon, 16 Jan 2023

If there is uncommitted code locally and you pull successfully, it means that there is no conflict between your code and the code pulled down. Git helps you merge automatically. If you want to return the code after the merge, you can only compare it manually.