- 弄亂了本地分支, 想回退到上次[git pull] 之后.
- git reset --hard origin/master # You will need to be comfortable doing this!
- git reset HEAD~1 - 已經(jīng)開始進(jìn)行代碼修改, 但是發(fā)現(xiàn)在不想變更的分支上.
git checkout -b new_branch_name # just create a new branch
git add . # add the changes files
git commit -m"your message" # and commit them
- 弄亂了一個(gè)文件, 想回退到該文件上次[git pull]之后.
git checkout your/directories/filename - 做了本地修改, 當(dāng)執(zhí)行[git rebase]/[git reset] 時(shí)不想丟失這些本地修改.
手動(dòng)拷貝整個(gè)目錄 - rebasing 過程中弄亂了.
git rebase --abort # To abandon interactive rebase and merge issues - 在[push] 之前修改commit 信息.
git commit --amend - 退出[git log] 的結(jié)果顯示
press [q] - 在工程目錄下刪除git 相關(guān)的信息.
rm -rf .git - 撤銷一個(gè)已發(fā)布的commit.
git revert --no-edit HEAD22 - 添加遠(yuǎn)程url.
git init
git remote add origin - 添加private key.
cd ~/.ssh
ssh-keygen -t rsa -C ‘xxx@gmail.com' - 回退到某個(gè)commit.
git reset --hard <tag/branch/commit id>
git push <reponame> -f - 忽略和恢復(fù)追蹤文件的變化
git update-index --assume-unchanged file
git update-index --no-assume-unchanged [<file> ...]