-----------随笔记记,给自己备份------------

1、查看分支

  查看当前分支:git branch

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

 

2、切换到分支A

  git checkout A

 

3、当前为分支A,提交代码到分支A

  git commit -am "提交备注" 

  (git commit -a 会先把所有已经track的文件的改动add进来,然后提交)

  3.1、提交指定文件(不全部提交)

    先进入要提交文件的目录,然后:

    git add GatherService.java TransService.java

    git commit -m "提交备注" 

 

4、远程推送到当前分支

  git push

 

5、将分支A上的代码合并到分支B上

  先切换到分支B   git checkout B

  再合并  git merge A

  再提交  git commit -am "合并分支A"

  再推送  git push

 

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

  git fetch origin 远程分支名(如:git fetch origin feature/微创业二期)

  git checkout -b 本地分支名x origin/远程分支名x(如:git checkout -b hhhh master)

相关文章:

  • 2021-09-27
  • 2022-12-23
  • 2021-08-20
  • 2022-02-20
  • 2021-09-18
  • 2021-06-01
  • 2021-06-18
  • 2021-09-23
猜你喜欢
  • 2021-11-21
  • 2021-10-29
  • 2021-11-03
  • 2022-01-18
  • 2021-12-26
  • 2021-11-22
  • 2021-11-02
相关资源
相似解决方案