mohuk
mohukh
Joins the work done in 2 branches
No Fast Forward (no-ff)
Fast Forward
If no commits are made to the parent branch after the feature was branched off
HEAD is moved ahead by the number of commits in the feature branch
If commits are made to the parent branch after the feature was branched off
A merge commit is created combining changes of parent commits and feature commits and is merged into the parent branch
Joins the work done in 2 branches
Pros:
Cons:
Pros:
Cons:
branch.pushed() ? merge() : rebase();
$ git merge alice/master
Auto-merging README.md
CONFLICT (content): Merge conflict in README.md
Automatic merge failed; fix conflicts and then commit the result.
<<<<<<< HEAD
Hello, Cat !
=======
Hello, Dog !
>>>>>>> alice/master
# Accepting our changes i.e. master
$ git checkout README.md --ours
# Accepting their changes i.e. alice/master
$ git checkout README.md --theirs
# Some complicated stuff, it can use any tool other than vimdiff
$ git mergetool -t vimdiff
Always keep you feature branches updated before pushing changes
# Working directly on develop
$ git pull --rebase origin develop
# Working on a branch from develop
$ git checkout develop
$ git pull origin develop
$ git checkout feat/mock
$ git rebase develop
# Working directly on develop
$ git pull origin develop
# Working on a branch from develop
$ git checkout develop
$ git pull origin develop
$ git checkout feat/mock
$ git merge develop
Merge
Rebase
Creates a new undo commit
Moves the HEAD back to erase commit
# Reset HEAD by one commit
$ git revert HEAD~0
# Reset a specific commit
$ git reset edfb4b55651af6de35753e4eef171107c37d5396
# Revert the last commit made
$ git revert HEAD~0
# Revert a specific commit
$ git revert edfb4b55651af6de35753e4eef171107c37d5396
$ git commit readme.md --patch
diff --git a/readme.md b/readme.md
index c212d60..f9f7184 100644
--- a/readme.md
+++ b/readme.md
@@ -1,4 +1,4 @@
-MOVE IT !
+MOVE it !
-Moveit!
+Move IT!
Stage this hunk [y,n,q,a,d,/,s,e,?]? s
Split into 2 hunks.
@@ -1,3 +1,3 @@
-MOVE IT !
+MOVE it !
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? y
@@ -2,3 +2,3 @@
-Moveit!
+Move IT!
Stage this hunk [y,n,q,a,d,/,K,g,e,?]? n
[master d186e5c] crraazzzyyy
1 file changed, 1 insertion(+), 1 deletion(-)
$ git rebase -i HEAD~3
pick 54c4c28 freefall¬
pick d186e5c crraazzzyyy¬
¬
# Rebase ebbf626..d186e5c onto ebbf626¬
#¬
# Commands:¬
# p, pick = use commit¬
# r, reword = use commit, but edit the commit message¬
# e, edit = use commit, but stop for amending¬
# s, squash = use commit, but meld into previous commit¬
# f, fixup = like "squash", but discard this commit's log message¬
# x, exec = run command (the rest of the line) using shell¬
#¬
# These lines can be re-ordered; they are executed from top to bottom.¬
#¬
# If you remove a line here THAT COMMIT WILL BE LOST.¬
#¬
# However, if you remove everything, the rebase will be aborted.¬
#¬
# Note that empty commits are commented out¬
MAJOR.MINOR.PATCH
$ git tag -l "v1.8.5*"
$ git tag -a v1.4 -m "my version 1.4"
Light weight tags
Annotated tags
$ git push origin master --tags
No more code backups, zips, tars, blah
Questions, comments, discussions...