如何查詢branch呢git
git-show-branch - Show branches and their commits
參考博文:express
https://git-scm.com/docs/git-show-branchless
如何刪除錯誤創建的branch呢fetch
git branch -D bugfix
-d
--deletespa
Delete a branch. The branch must be fully merged in its upstream branch, or in
HEAD
if no upstream was set with--track
or--set-upstream
.code-Dip
Shortcut for
--delete --force
.rem-lget
--create-reflogit
Create the branch’s reflog. This activates recording of all changes made to the branch ref, enabling use of date based sha1 expressions such as "<branchname>@{yesterday}". Note that in non-bare repositories, reflogs are usually enabled by default by the
core.logallrefupdates
config option.-f
--force
Reset <branchname> to <startpoint> if <branchname> exists already. Without
-f
git branch refuses to change an existing branch. In combination with-d
(or--delete
), allow deleting the branch irrespective of its merged status. In combination with-m
(or--move
), allow renaming the branch even if the new branch name already exists.
git push origin --delete <branchName>
步驟3、本地不要再追蹤遠程中已經沒有用的了
Deleting a local remote-tracking branch:
git fetch --all --prune
After deleting the local branch with git branch -d
and deleting the remote branch withgit push origin --delete
other machines may still have "obsolete tracking branches" (to see them dogit branch -a
).
"git fetch" learned --all
and --multiple
options, to run fetch from many repositories, and --prune
option to remove remote tracking branches that went stale. These make "git remote update" and "git remote prune" less necessary (there is no plan to remove "remote update" nor "remote prune", though).