[Git]常用命令整理(自用,用到哪整理到哪)
【關(guān)于拉取/提交】
git add . 暫存所有更改
git commit -m '描述'
git commit -m '描述' --no-verify 不進行代碼檢查,提交代碼
git push
git push --set-upstream origin 分支名 推送新分支到遠端
git pull
git pull --rebase 在本地commit之后使用,不產(chǎn)生merge信息,保持分支整潔
git config pull.rebase 查看pull是否用了rebase方式,返回false則為merge方式。
git config pull.rebase false 設(shè)置pull.rebase為false,即設(shè)置為merge方式。
【關(guān)于增刪改分支】
git branch -D 分支名 刪除本地的某個分支,強制性不校驗的
git branch 新分支名 以當前分支內(nèi)容,新建一個分支
git branch -m 舊名字 新名字
【合并分支】
合并某個分支的內(nèi)容到本分支下:
git checkout 發(fā)起合并的分支名 (切換分支)
git merge 被合并的分支名 (合并分支)
【修改本地提交信息】
git commit --amend -m "新的提交信息" 修改最近一條commit
【關(guān)于無法獲取遠端分支的問題】
git fetch 獲取遠程倉庫信息
git fetch origin 分支名 獲取一個遠程分支的更新信息
git checkout -b 本地分支名 origin/遠程分支名 拉取一個遠程分支到本地
git remote update 執(zhí)行
git fetch 后仍看不到分支后使用

浙公網(wǎng)安備 33010602011771號