git back to an historical version and submit some documents

The current project using git management code, the use of the process will encounter some problems, here to record

1, after the merger the code

The following interface will appear in the combined crew of the code, the beginning will be closed and re-opened, never tired to unbearable

Solution:
This occurs interface to prompt you to enter merger news

  • The keyboard to enter the letters i insert mode (skippable);
  • Press Escthe Escape key;
  • Input :wq, press Enterthe key;

2, rolled back to an historical version

  • git log Version history (bunch of yellow text after text commit is the version number)

  • Performs a version number to find a corresponding fall back to a version of the command, such as:

git reset --hard 20a3bfed06194df0161926c310bc7f91c11a367e

3, submit some documents

After a lot of locally modified files, but only need to submit some documents

git add 单个文件名
git stash -u -k// Save the modified content to the stack area, -u you modify a file but not add to retain -k keep the front add a file regular filing
git status// This file is displayed only when you submit separate updates
git commit -m 'update'
git push origin master

Once submitted, the need to continue the brick yard, then it would come back before the hidden variable changes

git stash popThis step is very important Oh ~
git stash command role is to present, but also do not want to have to modify the content submitted to save the stack, can follow a branch (may be they would be in other branches) recovered on the stack Content.

4, modify the file effective immediately .gitignore

git rm -r --cached .  #清除缓存  
git add . #重新trace file  
git commit -m "update .gitignore" #提交和注释  
git push origin master 

Guess you like

Origin www.linuxidc.com/Linux/2019-11/161293.htm