git 命令实用功能

git 把某次提交合并到另一个分支

查看提交的commit id

git log 

切换要合并的分支

git checkout dev

拉取要提交的代码到本地仓库

git cherry-pick commitid

提交到远程仓库

git push

git merge 失效

git 放弃本地修改,强制更新

git fetch --all

git reset --hard origin/dev2

git pull

这里的git fetch只是下载远程的库的内容,不做任何的合并 git reset把HARD指向刚刚下载的最新的版本。

推送本地分支到远程分支

git push origin wishnt:wishnt

拉取远程分支到本地

git checkout -b wishnt origin/wishnt

git 拉取所有分之到本地

git branch -r | grep -v '\->' | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
git fetch --all
git pull --all

批量删本地:  git tag -l| awk '/v-1.[0-9]{1}.[0-9]{1}$/ {print $1}'|xargs git tag -d

批量删远程: git show-ref --tag | awk '/v-1.[0-9]{1}.[0-9]{1}$/{print $2}' | xargs git push origin //这里的空格要注意

git show-ref --tag | awk '/v-1.[0-9]{1}.[0-9]{1}$/ {print ":" $2}'| xargs git push origin

 

git show-ref --tag | awk '/v-1.[0-9]{1}.[0-9]{1}-[a-c]{1}$/ {print ":" $2}'| xargs git push origin

 

查看本地:  git tag -l

查看远程:  git show-ref --tag

 

在本地进行开发结束后,使用 git branch -d branchName 删除本地分支。

此时如果想同步删除已经 Merge 到 Master 的远程分支,使用 git push origin --delete branchName 进行删除。

git checkout b a.txt

拉取b分支的某个文件

 

git 添加远程仓库

git remote add origin http://gitlab.atreez.com/walker/pay-wishnt.git

git 查看远程仓库

git remote -v

.gitignore 忽略文件不管用

git rm -r --cached .

git tag tag信息 -m "注视信息”

git tag -l -n 查看tag 标签以及信息

已经存在的目录中 git 远程仓库到本地

git init 初始化

git remote add origin http://gitlab.atreez.com/walker/chanwp-th.git 添加git仓库地址

git fetch --all

git reset --hard origin/master

git pull 拉取代码

创建本地分支并拉取远程分支

git checkout -b chanwp-th origin/chanwp-th

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值