git一些基本操作

1.创建一个branch
查看当前已经存在的branch
git branch
git remote -v
创建一个新的branch在服务器上
git push upstream dev
 
将自己的origin和server的upstream关联后,才能通过 git fetch upstream 来将server上最新的code更新到自己的origin
2.git之http方式设置记住用户名和密码
git config --global credential.helper store
 
3.提交代码到<branch name>
从platform/upstream更新代码
git fetch upstream
git rebase -i upstream/<branch name>
将所有发生变化的文件添加到提交队列中
git add .
提交代码
git commit -m “提交说明”
git push origin <branch name>
 
4.从remote上取一个新的branch到本地
git checkout -b <branch name> upstream/<branch name>
 
 
git push origin <local branch name>:<branch name>
 
5.merge branch a into b
git checkout <branch b>
git fetch upstream
git rebase -i upstream/<branch b>
git merge --no-ff upstream/<branch a>
git push origin <branch b>
 
git update-index --assume-unchanged <具体文件全路径>
git update-index --no-assume-unchanged <具体文件全路径>
 
git stash pop
 
6.强制退回到某次提交
切换branch
git checkout <branch>
查看提交日志
git log
退回到某次提交
git reset --hard <提交的编号>
 
7.删除服务器上的版本
git push origin --delete <branch name>
 
 
git checkout -b <new branch name> <from where>
 
git fetch upstream
git checkout -b upstream-dev upstream/dev
git push origin upstream-dev:dev
 
git checkout -b dev origin/dev

转载于:https://www.cnblogs.com/LP1204/p/9997087.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值