git memo

  • git branch -a: 可以查看本地分支和远程分支情况
  • git checkout -b fix-failing-tests origin/fix-failing-tests: 从远程分支拉取更改
    • 创建了一个名为 fix-failing-tests 的新分支
    • checkout 那个分支
    • 将更改从 origin/fix-failing-tests 拉到该分支
  • git remote show origin: 查看本地分支和追踪情况
  • git remote add origin [url]: 新增远程仓库
  • git remote prune origin: 同步远程分支情况到本地,如果远程删除了分支,本地就会同步过来。
  • git branch -D [branch name]: 删除本地分支
  • git push origin --delete Chapater6:可以删除远程分支Chapater6
  • git fetch -p: 远程分支被删除了,同步到本地
  • git checkout commitId -b [branch name]:从某个commit点切出一个新分支
  • git config --global credential.helper store: 记住git的http用户名密码
  • git rm -r --cached [file]: 从git仓库移除文件,不会删除该文件
  • git commit --amend:git 修改最近一次commit 的注释
  • 配置mergetool和difftool
git config --global merge.tool bc3
git config --global mergetool.bc3.path "E:\Program Files\Beyond Compare 4\BCompare.exe"

git config --global diff.tool bc3
git config --global difftool.bc3.path "/usr/bin/bcompare" 
  • git status显示中文乱码
git config --global core.quotepath false
  • git log显示中文乱码
git config --global i18n.commitencoding utf-8
git config --global i18n.logoutputencoding utf-8
echo "LESSCHARSET=utf-8" >> ~/.bashrc && source ~/.bashrc
  • git记住http用户名密码
git config --global credential.helper store
  • git新增tag
git tag -a <版本号> -m "<备注信息>"
git push origin --tags
  • git删除tag
git tag -d V0.2.0
git push origin :refs/tags/V0.2.0
  • git查看tag
git show V0.2.0 (可以看到对应commit id)
git tag -l -n
  • 将远程指定分支 拉取到 本地指定分支上:
git pull origin <远程分支名>:<本地分支名>
  • 将远程指定分支 拉取到 本地当前分支上:
git pull origin <远程分支名>
  • 查看stash保存的时间
git stash list --date=relative
git stash list --date=short
git stash list --date=loca

git 使用ssh密钥

1、生成公钥:ssh-keygen -t rsa -C “your_email@youremail.com”
2、查看公钥:cat ~/.ssh/id_rsa.pub // windows in user dir
3、登陆你的github帐户。点击你的头像,然后 Settings -> 左栏点击 SSH and GPG keys -> 点击 New SSH key

git cherry-pick

git cherry-pick 教程

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值