Git常用命令

Tags

List Tags : git tag -l

Check a specific tag : git checkout tags/<tag_name>


Sync with Remote

git fetch origin
git reset --hard origin/master
git clean -f -d 

Remote

git remote 用来管理本地的remote,在这里是服务器上的repo在本地成为remote。
git remote -v  显示所有的remote
git remote remove vso 删除本地名为vso的remote
git remote set-url originhttps://xxx.visualstudio.com/DefaultCollection/xxx/_git/xxxxx  更新本地名为origin的remote的地址


Merge vs. Rebase

git merge

git rebase

Branch

git branch <new-branch>  创建新branch

git checkout <branch>      切换branch

git checkout -b <new-branch>    创建并切换到新branch


Commit to local repo andpush to branch

git commit -m"commit comment"

git push origin<branch>


Hard Pull

git reset --hard origin/master


Diff

git difftool


配置difftool使用Beyond Compare

git config --global diff.tool bc4
git config --global difftool.bc4.cmd '\"c:/program files (x86)/beyond compare 4/bcomp.exe\" \"$LOCAL\" \"$REMOTE\"'
 
git config --global merge.tool bc4
git config --global mergetool.bc4.cmd '\"c:/program files (x86)/beyond compare 4/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\"'
git config --global mergetool.bc4.trustExitCode true

Sub module
git submodule init
git submodule update    // sync the submodule to local
https://chrisjean.com/git-submodules-adding-using-removing-and-updating/   (how to upgrade submodule references)

git submodule update --init --recursive // sync the submodule to local recursively


git submodule foreach --recursive git fetch
git submodule foreach git merge origin master





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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值