git Cheat Sheet

本文总结了Git中常用的命令操作流程,包括添加更改、提交注释、推送分支、解决冲突等,帮助开发者掌握版本控制的基本技能。

1. add changes
git add --all

 

2.commit changes and add note
git commit -m "<Description of changes>"

 

3. push change to the branch
git push origin master

git push xxx.git

 

4.when conflicts, pull changes from origin branch

git pull xxx.git

 

5. show difference

git remote

git diff origin/master > ~/CAA\ CODE/log/dif_3rd_Pty.log

 

6. switch branch

git checkout <branch_name>

 

7.pull from server

git pull origin <source_branch>

= fetch 

 

8.update, reset

git clean -d -f -f

git reset --hard <head~1>

 

9.revert

git reset --hard <commit-hash>
 git push -f origin master

 

10.conflict

head: your branch's newest version

master: where you merged from

 

begin

<<<<<<< HEAD
    my code
=======
    old code
>>>>>>> master

end

 

step1.

solution:

begin

 my code

end

 

step2.

commit 

 

11.

转载于:https://www.cnblogs.com/fuxiaotong/p/6627834.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值