git tag
*
是通配符) git tag -l "v1.4.2*"
git show v1.2.3
git tag --contains <commit>
git tag v1.2.3
git tag -a v1.2.3 -m "your message"
git tag -a v1.2.3 -m "your message" 9fceb02
git push origin v1.2.3
git push origin --tags
git tag --delete v1.2.3
git push origin --delete tag <tagname>
Terminal window
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"
以下回答来自 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 命令。例如:
Terminal window
git add -f path/to/x64
3 使用 git check-ignore 命令: 如果你不确定某个文件或文件夹是否被忽略,可以使用 git check-ignore 命令进行检查:
Terminal window
git check-ignore -v path/to/x64
Terminal window
git merge origin/dev --strategy=resolve
Terminal window
git branch --merged | grep -v 'dev' | xargs -n 1 git branch -d
Git 之删除本地无用分支_dearfulan 的博客 - CSDN 博客_git 删除本地无效分支
Terminal window
git fetch -pgit remote prune origin
Terminal window
git merge-base [-a|--all] <commit> <commit>…
Terminal window
git branch --contains <commit>git branch -r --contains <commit>git tag --contains <commit>
Terminal window
git rev-list --count HEAD
Terminal window
git rev-parse HEAD
# 如果只是查看,则直接使用 show 命令就可以git show HEAD
Terminal window
git config --global alias.co checkoutgit config --global alias.lg log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
提交检出均不转换
Terminal window
git config --global core.autocrlf false
允许提交包含混合换行符的文件
Terminal window
git config --global core.safecrlf false
Terminal window
git reflog show --color --abbrev-commit --all --pretty=oneline --date=short --after="2020-05-22" | grep 'commit' | grep -v 'refs'
Terminal window
git commit -m "version + 2" --allow-empty
原文链接: https://cloud.tencent.com/developer/article/2481460
本作品采用 「署名 4.0 国际」 许可协议进行许可,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接。