Git Branch Branch and Merge branch (GO)

Source: Internet
Author: User
Tags diff

Tag: File mat sed repos. NET git diff stat file objects

See what branch are currently available
[email protected] xmrobotium$ git branch* master
Create a new branch xm2.x
[email protected] xmrobotium$ git branch xm2.x
Switch to a branch
[email protected] xmrobotium$ git checkout xm2.x
New and switch to the branch, for example: xm2.x
[email protected] xmrobotium$ git checkout -b xm2.x
Check Again
[email protected] xmrobotium$ git branch* master  xm2.x
Add a file to your repo
[email protected] xmrobotium$ git add bixiaopeng.txt
Add all the files to git Add.
[email protected] xmrobotium$ git add .
Commit a file
[email protected] xmrobotium$ git commit -m "bixiaopeng test case"
Commit to Local
[email protected] xmrobotium$ git commit -a -m "xm2.x test case"[xm2.x f78f430] xm2.x test case 39 files changed, 384 insertions(+) create mode 100644 AndroidManifest.xml………….
See the differences in commits several times
[email protected] xmrobotium$ git diff
Push the branch to the remote
[email protected] xmrobotium$ git push origin xm2.xCounting objects: 78, done.Delta compression using up to 8 threads.Compressing objects: 100% (51/51), done.Writing objects: 100% (77/77), 565.97 KiB, done.Total 77 (delta 3), reused 0 (delta 0)remote: To [email protected]*****.com:/home/git/repositories/xiaopeng.bxp/xmrobotium.gitremote:  * [new branch]      xm2.x -> xm2.xTo [email protected]****.com:xiaopeng.bxp/xmrobotium.git * [new branch]      xm2.x -> xm2.x
viewing remote branches
[email protected] xmrobotium$ git branch -r  origin/master  origin/xm2.x
View local and remote branches
[email protected] xmrobotium$ git branch -a  master* xm2.x  remotes/origin/master  remotes/origin/xm2.x
Modify the name of branch
[email protected] xmrobotium$ git branch -m xm2.x test2.x[email protected] xmrobotium$ git branch -r  origin/master  origin/xm2.x
View all local and remote branches
[email protected] xmrobotium$ git branch -a  master* test2.x  remotes/origin/master  remotes/origin/xm2.x
Delete Remote Branch
[email protected] xmrobotium$ git push origin --delete xm2.xremote: To [email protected]****.com:/home/git/repositories/xiaopeng.bxp/xmrobotium.gitremote:  - [deleted]         xm2.xTo [email protected]*****.com:xiaopeng.bxp/xmrobotium.git - [deleted]         xm2.x[email protected] xmrobotium$ git branch -r  origin/master  
16. Git Merge Branch

First switch to the branch you want to merge into, run the ' git merge ' command (for example, merge the test2.x branch into the xm3.0 branch in this example, go to the xm3.0 branch and run the git merge test2.x command) if the merge goes well:

Make sure the current branch is xm3.0
[email protected] xmrobotium$ git status On branch xm3.0nothing to commit, working directory clean[email protected] xmrobotium$ git branch  master  
Merge conflict handling:

Automatic merge failed; Fix conflicts and then commits the result.

After modifying a conflicting file, git add file then git commit

Git Branch Branch and Merge branch (GO)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.