欢迎您访问 最编程 本站为您分享编程语言代码,编程技术文章!
您现在的位置是: 首页

git 命令和其他相关操作

最编程 2024-03-20 17:06:21
...

git常用命令

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/

推荐阅读