git常用命令等相关操作

git常用命令

git clone url

git clone url dir

git branch -a 查看所有的分支

git branch -r 查看所有远程分支

git branch [name] 新建本地分支

git checkout [name] 切换分支

git checkout -b [name] 新建并切换分支-----具体从哪个分支新建呢?

git checkout -b [name] [orgin/远程分支名] 从远程分支 新建本地分支 并切换到新分支

git fetch origin [远程分支名]:[name] 从远程分支 拉取 到本地分支,但不会切换到新分支

idea的git命令

1.idea的fetch命令:git          -c credential.helper= -c core.quotepath=false -c log.showSignature=false       fetch origin --recurse-submodules=no --progress --prune

2.idea中将.gitigore改名.gitignore

git -c credential.helper= -c core.quotepath=false -c log.showSignature=false add --ignore-errors -A -- .gitignore
git -c credential.helper= -c core.quotepath=false -c log.showSignature=false rm --ignore-unmatch --cached -r -- .gitigore

3.Commit code

git [...] add --ignore-errors -A -f -- xxx.java xxx.java

git [...] commit -F /private/var/folders/c0/2cj2cvs510gbbc7c4kjylh200000gq/T/git-commit-msg-.txt --
[dengr013/project-init 1ad3d7c] 备注

[...]表示-c credential.helper= -c core.quotepath=false -c log.showSignature=false

4.提交代码

git 【...】 push --progress --porcelain origin refs/heads/project-init:project-build

远程分支名称不带origin,从本地分支project-init提交到远程分支project-build

.gitigore文件

target/
.idea/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值