git使用

本文总结了Git中常用的命令操作流程,包括项目的克隆、文件的添加与提交、分支的管理等,适合初学者快速上手及进阶用户查阅。

 

克隆新项目:
git clone ssh://xin.zhang@192.168.221.71:29418/DLOCKMS

克隆完成后要立刻执行添加hook:
scp -p -P 29418 xin.zhang@192.168.221.71:hooks/commit-msg .git/hooks/

其他人的更新拉到本地.git里面
git fetch

git rebase origin/当前的branch
     git rebase origin/master
     git rebase origin/test-branch

添加文件:
git add .

commit到本地:
git commit -m “This is comment”

push到repository的review board:
git push origin HEAD:refs/for/master

在.gitignore里添加内容忽略commit:
.gitignore  *.a

git reset --soft HEAD~n
git reset --hard HEAD~n  (会删除所有更改,小心使用)


git revert commit-hash  

git branch  (查看当前在哪个branch)

git branch xxx (创建一个新的branch)
git checkout xxx(转到这个branch上去)


git checkout -f
git clean -f -d -x  (清除repo里面一切没有git add 操作过的文件,慎用!)

"detached head"   LOCAL CHANGE.   ------------    git reset --hard HEAD~1




git reflog (任何git操作都可以恢复,前提是文件被git add 过了)

git local change ---  
】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】】

git rebase origin/master 冲突之后
解决冲突
git add . -A
git rebase --continue
git push origin HEAD :refs/for/master


]]]]]]]]]]

查看本地和远程分支

git branch -a

 合并分支:

http://blog.youkuaiyun.com/wirelessqa/article/details/20153689

 

转载于:https://www.cnblogs.com/littlehoom/p/4919645.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值