Home > Net >  repeat git pull without password after remving changes to tracked files
repeat git pull without password after remving changes to tracked files

Time:11-22

Many times when I do git pull, it downloads all changes from the server and then gives me an error Your local changes to the following files would be overwritten by merge:. So, I either stash or remove changes in the listed files. Then I have to do git pull again by entering username and password. Since git would've downloaded the changes from server in my first attempt, is it possible to reuse that directly using some command? I don't want to enter username and password again.

PS: This is not about storing my password in a git cache file or such. I am okay with entering the password the first time. But I want to skip entering it again the second time, if I got some error the first time.

CodePudding user response:

git pull is actually running 2 commands. (https://git-scm.com/docs/git-pull)

  1. A git fetch to get the changes from the server.
  2. A git merge (or rebase) up against the remote.

So what you want to do is rerun the second step.

git merge @{u}

  •  Tags:  
  • git
  • Related