GIT development of common command set

[File] repair gitignoe

git rm -r --cached .
git add .
git commit -m 'update .gitignore'
git  push

[Branch] wrong code development

git add .      (把所有改动暂存)
git stash     (把暂存的文件提交到git的暂存栈)
git checkout  本该提交代码的分支
git stash pop (将暂存栈中的代码放出来)

[Commit] roll back to a

git reset --hard af559448cccfb991e455c47682ca763ee508330e
git push origin develop -f

[Give up a local modify update designated as remote branch]

git fetch --all
git reset --hard origin/develop

[Extracting files that have been changed between two commit git from the inside, to download package]
When the line code modified code coverage, very practical

git archive --format=zip HEAD `git diff --name-only 8bbf69c253801228ff504ab080ce7cf44a924971 a27d045d8c60d6c62a4061b94763886577e1c0eb` & my_diff.zip

Guess you like

Origin www.cnblogs.com/JaminXie/p/11527111.html