git基本操作

1.删掉远程分支:
git push origin --delete 分支名称
eg:git push origin --delete hotfix/fix_liveroom_ylf_20161126

2.查看所有分支:
git branch -a 或者gitbranch --all

3.拉去远程分支并切换至此分支:
git checkout -b 本地分支名称 远程分支名称

4.切换分支:
git checkout 本地分支

5.提交所改的东西:
git add .
6.增加注释:
git commit -m "@misc 这个是注释"

7.提交代码:
git commit

8.拉取最新代码:
git pull

9.推送已经提交的代码
git push
10.合并指定分支到当前分支:
git merge 指定分支

11.删掉本地分支:
git branch -D 本地分支名称

12.推送本地分支local_branch到远程分支 remote_branch并建立关联关系
a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换local_branch
git push

b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch
git push -u origin/remote_branch

c.远程没有有remote_branch分支并,本地已经切换到local_branch
git push origin local_branch:remote_branch

13.删除本地分支local_branch
git branch -d local_branch

14.删除远程分支remote_branch
git push origin :remote_branch

git branch -m | -M oldbranch newbranch 重命名分支,如果newbranch名字分支已经存在,则需要使用-M强制重命名,否则,使用-m进行重命名。

git branch -d | -D branchname 删除branchname分支

git branch -d -r branchname 删除远程branchname分支


15.修改提交的代码的注释
git commit --amend

16.撤销掉本地未提交的变动:
git checkout .

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值