Gitbash常用指令总结

Part I git 开始的指令

在这里插入图片描述

1、git init:初始化一个Git仓库;
2、git clone:从远程仓库克隆代码到本地;
直接使用网址

  git clone <url>

or
用a代替网址

 git remote add a <url>
 git clone a

3、git add:添加文件到暂存区;
文件名

git add <filename>

or
添加所有文件

git add *

4、git commit:将暂存区的文件提交到本地仓库;

git commit -m 'comment'

or
自动调出默认编辑器

git commit 

or
不用add

git commit -a -m 'comment'

5、git push:将本地仓库的代码推送到远程仓库;

git push <remote> <branch>

won’t record that the local branch ‘master’ needs to be pushed to upstream (origin) ‘master’ (upstream branch)
6、git pull:从远程仓库拉取最新代码;
7、git branch:列出所有本地分支;
8、git checkout:切换分支或恢复工作树文件;

git checkout <tag or branch or ca82a6d>

9、git merge:合并指定分支到当前分支;
10、git status:显示工作树的状态;
11、git log:显示提交日志;
–graph option to see what divergent histories look like.
–decorate option to easily visualize where our branch
pointers are located
–all option 显示所有commit

 git log --oneline --decorate --graph --all

12、git diff:显示工作树与暂存区或本地仓库之间的差异;
特定commit,特定文件,使用difftool比较

$git difftool HEAD:src/main/java/com.xyz.test/MyApp.java HEAD^:src/main/java/com.xyz.test/MyApp.java

13、git stash:将当前工作区的变更储存到一个临时区域;
14、git tag:添加、列出或删除标签;
15、git remote:管理远程仓库;
16、git fetch:从远程仓库拉取最新代码,但不自动合并到本地仓库;

Part 2 其他指令

1.用默认的软件打开文件

start <filename>
explorer <filename>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值