Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”
- Updated remote branch
git remote update origin --prune
Copy the code
-
What you need to do after deleting all branches:
-
Git remote update Origin –prune looks at all remote branches. Existing/deleted.
-
Git checkout (develop) If the remote branch exists, just switch.
-
Git pull Origin (develop) updates the newly created branch.
-
Git fetch –all Updates all remote branches.
-
-
Pull all the branches
git pull -p
Copy the code
- View all remote branches
git branch -a
Copy the code
- Deleting a Remote Branch
Git push origin :branchName git push origin --delete branchNameCopy the code
- Delete a local branch:
git branch -d/D <BranchName>
Copy the code
TAG
- List all tags
git tag
Copy the code
- The new tag
Use git tag to create a tag with the tag name
Git tag tagName (v1.0.0)Copy the code
You can also add the -a parameter to create a tag with a note, which is specified by -m. If you do not enter -m, the creation process system will automatically open the editor for you to fill in the remarks.
Git tag -a tagName(v1.0.0) -mCopy the code
- Viewing tag Information
The git show command displays details about the tag, including the commit number.
Git show tagName (v1.0.0)Copy the code
- Specify a commit number with a tag
Tagging does not have to be above the head, but can be done in previous versions, as long as you know the checksum of a committed object (obtained from git log, the first few digits of the checksum).
Git tag - a tagName (v1.0.0) 8133 a8038a788cd4e62914befff39c0dac2e06ff -m 'note information'Copy the code
- Synchronize the tag to the remote server
In the same way that a Git push is used to push a tag to a remote server after the code is submitted, a tag needs to be pushed to a remote server. Push a single branch with git push Origin [tagName].
Git push Origin tag (v1.0.0) git push origin tag (v1.0.0Copy the code
- Switch to a tag
Just like branches, you can switch directly to a tag. At this point, you are not in any branch and are in a wandering state. Consider creating a branch based on this tag.
Git checkout tagName (v1.0.0)Copy the code
-
Remove the tag
- Local deletion
Git tag - d tagName (v1.0.0)Copy the code
- Remote delete
Git push origin: refs/tags/tagName (v1.0.0)Copy the code