《Git执行操作》

本文最后更新于:2 小时前

拉取远程仓库

1、拉取远程主仓库:git clone 你的仓库地址

1
git clone https://gitee.com/nanfangzhe/adui_tranlate.git

2、拉取远程仓库分支 git clone -b 分支名称 仓库地址

1
git clone -b develop_lin-ui https://gitee.com/nanfangzhe/adui_tranlate.git

3、查询本地所有分支(当前选择的分支:分支名称前带 *号的) git branch

1
git branch

4、切换分支 git chechout 分支名

1
git chechout develop

5、查询远程所有分支 git branch -a

1
git branch -a

6、远程分支获取下来并命名切换 git checkout -b 本地分支命名 orgin/远程分支名

1
git checkout -b develop_lin-ui origin/develop_lin-ui

切换远程的develop_lin-ui分支,在本地起名为develop_lin-ui分支,并切换到本地的develop_lin-ui分支

7、提交改动文件的跟踪 git add .

1
git add .

8、只提交某个改动文件的跟踪 git add “文件”

1
git add nfz.txt

9、提交并添加日志信息(提交完还需要推送才会更新远程仓库)git commit -m “日志信息”

1
git commit -m "新增nfz.txt文件"

10、推送到当前选择分支库(git branch能查看当前选择的分支) git push

1
git push

11、推送到指定远程分支库 git push “远程主机名” “本地分支名” : “远程分支名”

1
git push origin develop_lin-ui:develop_lin-ui