git 常用命令笔记
git tag 常用笔记
查看 tag
-
列出现有 tag
git tag -
列出 v1.4.2 相关的 tag (
*是通配符)
git tag -l "v1.4.2*" -
查看指定 tag 的信息
git show v1.2.3 -
查看包含指定提交的 tag
git tag --contains <commit>
新建 tag
-
简单新建
git tag v1.2.3 -
带备注的新建
git tag -a v1.2.3 -m "your message" -
给指定 commit 添加 tag
git tag -a v1.2.3 -m "your message" 9fceb02
推送 tag
-
推送指定 tag
git push origin v1.2.3 -
推送所有 tag
git push origin --tags
删除 tag
-
删除本地 tag
git tag --delete v1.2.3 -
删除远端 tag
git push origin --delete tag <tagname>
参考链接:
alias
git config --global alias.lg "log --graph --pretty=tformat:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --decorate=full"
gitignore
以下回答来自 GPT4
在 Git 中使用 .gitignore 文件排除特定文件或文件夹后,如果需要重新包含某些被排除的内容,可以通过以下步骤实现,以特定路径的 x64 文件夹为例
1 编辑 .gitignore 文件:
如果你只想排除大部分 x64 文件夹,但保留特定的 x64 文件夹,可以在 .gitignore 文件中进行更精细的配置。例如,假设你有一个 x64 文件夹在 path/to/ 目录下,你可以这样修改 .gitignore 文件:
# 排除所有 x64 文件夹
**/x64/
# 但排除特定 x64 文件夹
!path/to/x64/
2 使用 git add -f 命令:
如果你已经提交了 .gitignore 文件,并且想要强制添加被忽略的文件或文件夹,可以使用 git add -f 命令。例如:
git add -f path/to/x64
3 使用 git check-ignore 命令:
如果你不确定某个文件或文件夹是否被忽略,可以使用 git check-ignore 命令进行检查:
git check-ignore -v path/to/x64

浙公网安备 33010602011771号