GIT 越用越好用呢。
如何查询branch呢
git-show-branch - Show branches and their commits
参考博文:
https://git-scm.com/docs/git-show-branch
如何删除错误建立的branch呢
步骤一、首先删除本地branch的方法
git branch -D bugfix
-d
--delete
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
.-D
Shortcut for
--delete --force
.-l
--create-reflog
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.
步骤二、删除远程branch
git push origin --delete <branchName>
步骤三、本地不要再追踪远程中已经没有用的了
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).