git命令

  • 临时保存密码

 git config --global credential.helper cache

  • 保存密码

 git config --global credential.helper store

  • 取消最近一次条件

git reset HEAD~1

git branch -vv

  • 删除远端分支

git push origin --delete

  • 删除文件夹的历史记录

git count-objects -v
git filter-branch --force --index-filter 'git rm --cached -r --ignore-unmatch <del_dir/>' --prune-empty --tag-name-filter cat -- --all
git count-objects -v
git push origin --force --all

  •  git stash

git stash save "save message"
git stash list
git stash apply 应用某个存储,但不会把存储从存储列表中删除
git stash pop 命令恢复之前缓存的工作目录,将缓存堆栈中的对应stash删除

  • 分支

git checkout -b develop origin/develop

  • 修改合并策略

git config pull.rebase true

  • 比较不同分支的同一个文件

git diff branch1 branch2 -- path/to/file

git diff branch1 path/to/file

  • 清除所有未跟踪文件,包括纳入ignored的文件 

git clean -dxf;

  • 忽略证书

git config --global http.sslVerify false

  • patch

git format-patch -o /output/directory 3a4b5c6..7c8a9b1

git apply /path/to/patch-file.patch

posted @ 2023-10-26 17:47  ahuo  阅读(13)  评论(0)    收藏  举报