1. Delete the local branch:
Delete local branch: git branch -D [branch_name]
Delete remote branch: git push origin :[remote branch] -- note the space after origin
Here's a handy way to remember this command: remember the git push [remote name] [local branch]:[remote branch] syntax we saw a while back,
if you omit [local branch], you're saying " Extract whitespace here and make it [remote branch]".
2.git create tag:
First, switch to the branch that needs to be tagged: git branch
Then, git tag <name>
you can type a new tag by typing the command: git tag v0.1
All tags can be viewed with the commandgit tag
The default tag is on the latest commit. Sometimes, what if you forget to tag, say, it's Friday, but the tag that should be on Monday isn't:
The method is to find the commit id of the historical submission, and then type it:
$ git log --pretty=oneline --abbrev-commit 6a5819e merged bug fix 101 cc17032 fix bug 101 7825a50 merge with no-ff 6224937 add merge 59bc1cb conflict fixed 400b400 & simple 75a857c AND simple
For example, to add merge
tag this commit, its corresponding commit id is 6224937
, type the command: git tag v 0 . 9 6224937
The tags are not listed in chronological order, but alphabetically. You can git show <tagname>
view tag information with:
Push tags to remote: 1.Push a single tag , the command format is: git push origin [tagname]
2. Push all tags , the command format is: git push [origin] --tags