How to push your code in git

Posted 星空守望者--jkmiao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了How to push your code in git相关的知识,希望对你有一定的参考价值。

1. display all the branches

git branch -a

2. delete branches

git br -d <branch> # 删除某个分支

git br -D <branch> # 强制删除某个分支 (未被合并的分支被删除的时候需要强制)

 分支合并和rebase

git merge <branch> # 将branch分支合并到当前分支

git merge origin/master --no-ff # 不要Fast-Foward合并,这样可以生成merge提交
Make sure you have the latest code
$git pull   
Create your local_branch and checkout to it
from [master] $git checkout -b loca_branch
Modify your code and add all modified files you want to commit $git add
-A Input commit messages $git commit -s Create your remote_local_branch and push your commit to it. $git push origin local_branch:remote_local_branch
 
查看分支
git branch
或者
git branch -v
 
A) 创建分支
git branch mystudygit1.0
 
B) 切换分支
git checkout mystudygit1.0
 
C) 删除分支
git branch -d mystudygit1.0  //如果该分支没有合并到主分支会报错
或者
git branch -D mystudygit1.0   //强制删除
 
D) 分支合并
比如,如果要将开发中的分支(develop),合并到稳定分支(master),
          首先切换的master分支:git checkout master。
然后执行合并操作:git merge develop。
如果有冲突,会提示你,调用git status查看冲突文件。
解决冲突,然后调用git add或git rm将解决后的文件暂存。
所有冲突解决后,git commit 提交更改。
例如:将acc2f69提交合并到当前分支
git merge acc2f69
 
E)合并
 
 
git如何clone 远程github中的分支?
git clone -b release_branch https://github.com/jetty/
 

以上是关于How to push your code in git的主要内容,如果未能解决你的问题,请参考以下文章

How to Exceed Your Goals in 2016

How to change your password of your mysql account in WampServer

How to make your issues in GitHub more professional? [Labels feature]

How to make your issues in GitHub more professional? [Labels feature]

How to edit codes on the server which runs jupyter notebook using your pc's bwroser

How to Fix Slow Code in Ruby