Conflicts displayed by git pull---solution git stash

git pull: shows conflict between local repository and remote repository

  1. Please, commit your changes or stash them before you can merge.    
  2. Aborting  

Solution:

git stash: Back up the current workspace, and save the backup content to the git stack, while keeping the content of the workspace consistent with the content submitted by me last time

git pull: pull the latest code from the remote warehouse, there is no conflict at this time

git stash pop: Read the last saved content from the git stack and restore the relevant content of the workspace. At this time, the workspace shows a conflict

 

The content between Updated upstream and ===== is the pulled content, and the content between ==== and stashed changes is the locally modified content. In this case, git does not know which line of content is needed, so you need to determine the content you need.

After the solution is completed, it can be submitted normally.

 

git stash other statements:

git stash list: view existing stash

stash@{0}: WIP on master: 049d078 added the index file

stash@{1}: WIP on master: c264051 Revert "added file_size"

stash@{2}: WIP on master: 21d80a5 added number to log

stash@{0}, stash@{1}, stash@{2} are the names of stash

master is branch

049d078,c264051,21d80a5 is the version number

 added the index file, Revert "added file_size", added number to log is the content submitted in the last few times

If you don't want to restore the stash of the last (last) commit with git stash,

If you want to apply an earlier stash, you can specify it by name: git stash apply stash@{2}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324971121&siteId=291194637