幫助:git help
查看分支:git branch
創(chuàng)建分支:git branch name
切換分支:git checkout name
創(chuàng)建+切換分支:git checkout –b name
提交所有變化:git add -A
提交暫存區(qū)到倉庫區(qū)附帶提交信息:git commit -m [message]
提交到遠(yuǎn)程倉庫:git push origin my_branch或 git push
本地分支推送到遠(yuǎn)程,沒有重新創(chuàng)建:git push origin newbranch:newbranch或 git push -u origin newbranch
比較兩個分支差異:git diff branch1 branch2
合并某分支到當(dāng)前分支:git merge name
保存當(dāng)前工作狀態(tài):git shash save 'name'
恢復(fù)保存內(nèi)容:git stash name
恢復(fù)保存的內(nèi)容并刪除:git stash pop 或者 git stash pop stash@{$num}
查看距上次提交的變動:git status
放棄合并:git merge --abort
刪除本地分支:git branch –d name
刪除遠(yuǎn)程分支:git push origin --delete [branch-name]
重新生成下本地的分支:git fetch -p