dplearning

看完不用,就是一个字:忘! 之前学了两天git结果今天要用的时候,啥也想不起来....

 

场景:

已有远程仓库: git@192.168.1.1:test/test.git   

要提交代码到远程仓库的新分支

 

1.本地文件夹初始化   在代码所在文件夹执行

git init

 

 

2.添加远程仓库

2.1 将本地主机中~/.ssh/id_rsa.pub 中的内容拷贝到远程仓库的profile->SSH Keys中    即添加认证

2.2 添加远程仓库

 git remote add origin git@192.168.1.1:test/test.git     

2.3 本地新建分支并切换到新分支

 git checkout -b new_branch 

2.4 提交修改到本地分支

git commit -m "add files"

2.5 提交本地分支到远程仓库

git push origin new_branch

 

 

 

其他中间折腾时用到的指令:

git fetch 
git merge  
git branch 
git branch -a  查看所有分支
git branch -r 查看远程分支
git log
git commit -am

 

分类:

技术点:

相关文章:

  • 2022-02-10
  • 2021-10-09
  • 2021-12-05
  • 2022-02-08
  • 2021-04-07
  • 2021-10-18
猜你喜欢
  • 2021-11-20
  • 2022-02-12
  • 2021-12-02
  • 2022-02-10
  • 2022-12-23
  • 2021-11-12
相关资源
相似解决方案