Version: git version 2.14.3 (Apple Git-98)
分支(branch)
git checkout -B branch_name // 本地創(chuàng)建分支,并切換到該分分支
git push origin --delete branch_name //刪除遠(yuǎn)程分支
git fetch -p // 獲取遠(yuǎn)程更新,并且刪除已經(jīng)不在遠(yuǎn)程存在的分支
git branch -D branch_name // 刪除本地分支
Tag
terminal: git tag 1.1.1 // 創(chuàng)建一個新的tag,為 1.1.1
terminal: git push origin --tags // 將本地的tag推送到遠(yuǎn)程
terminal: git tag -d 1.1.1 //刪除本地名為1.1.1的tag
terminal: git push origin --delete tag 1.1.1 //刪除遠(yuǎn)程tag 1.1.1
設(shè)置多個Gitconfig的user和email
我們平常開發(fā)中,在公司使用的是公司的賬號和用戶名, 我們發(fā)布Code到我們自己的Github上需要切換到自己的賬號和用戶名, 如何區(qū)分使用?
全局: git config
git config --global user.name "Your Name Here"
git config --global user.email your@email.com
單個工程: 在需要使用其他賬號和郵箱的項目目錄中, 單獨為當(dāng)前設(shè)置賬戶和郵箱
git config user.name "Your Name Here"
git config user.email your@email.com
git修改已提交commit的author
https://makandracards.com/makandra/1717-git-change-author-of-a-commit
Q:丟棄所有 untracked files?
git clean -f
Q:git修改已提交commit的author
git commit --amend -m "Inital init" --author="mistdon <wonderland.don@gmail.com>"
A: git-change-author-of-a-commit