Skip to content

Instantly share code, notes, and snippets.

@notdol
Created January 7, 2014 12:57
Show Gist options
  • Save notdol/8298927 to your computer and use it in GitHub Desktop.
Save notdol/8298927 to your computer and use it in GitHub Desktop.
git command

Gist

Reference : git book

Source Commit

 > git add . 
 > git commit -m "first commit" // commit local storage
 > git push 					// push source code to server

Create Branch

 > git branch issue1    // create new branch
 > git checkout issue1  // use new branch 

Source Merge

(when issue code complete. then merge to master branch ) issue1 -> master merge

 > git checkout master
 > git merge issue1

Create Branch ( server mode , multi user )

> git branch issue2 origin  //  create new branch
> git push origin issue2	// push branch to server

checkout , another user 
> git checkout -b newbranchname issue2

Source Conflict

issue1 ( editing index.html )

master ( editing index.html )

> git checkout master
> git merge issue1

print -> #   unmerged:   index.html

> git status 		// show conflict status 

in index.html

<<<<<<< HEAD:index.html
<div id='footer'>contact : email.support@github.com</div>
=======
<div id='footer'>
  please contact us at support@github.com
</div>
>>>>>>> issue1:index.html

editing source code ( include remove >>>> and <<<< ) then source commit

> git add .
> git commit 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment