===================================================================================
===
GIT BRANCHING
===================================================================================
===
All the branches (master and branches ) will reside on same path
system path is same for all [Link] can consider branches are virtual
portels(multiple copies of master)
touch [Link]
touch [Link]
touch [Link]
git branch
git branch branch1
git branch //in which branch
git checkout branch1
ls -ltr
touch [Link]
touch [Link]
git add . and git commit -m "branch1commit"
ls -ltr
git checkout master
git merge branch1
ls -ltr
git branch child2 git checkout child2
git checkout -b child2 --combined branch creation and login to branch
git branch -d branch1 --del merged branches
git branch -D branch2 --del unmerged branch
git branch
===================================================================================
====================
GIT MERGING
===================================================================================
====================
git checkout master
git merge branch1
git config --global [Link] vimdiff //Configure merge tool
kdiff3,p4merge,meld
$ git mergetool --tool-help
'git mergetool --tool=<tool>' may be set to one of the following:
emerge
gvimdiff
gvimdiff2
opendiff
p4merge
vimdiff
vimdiff2
kdiff3
Kaleidoscope
git mergetool
git merge --abort
git branch --merged //to see merged branchs
How to Undo a Merge
You should always keep in mind that you can return to the state before you started
the merge at any time. This should give you the confidence that you can't break
anything. On the command line, a simple "git merge --abort" will do this for you.
In case you've made a mistake while resolving a conflict and realize this only
after completing the merge, you can still easily undo it: just roll back to the
commit before the merge happened with "git reset --hard " and start over again.
===================================================================================
=================
master: create files and commit
git branch branch1
git checkout branch1
git log
git rebase master
$ git rebase master
Successfully rebased and updated refs/heads/branch1.
===================================================================================
=========
REVERT
===================================================================================
=========
Revert or UNDO the changes made in the previous commit
git revert <commit id>
git log
ls -ltr
touch [Link]
touch [Link]
git add .
git commit -m "latest commit"
git revert HEAD
git log
//evenfor revert also commitid will generate
can we do revert of revert commit bc you have commit id
===================================================================================
==============
RESET
===================================================================================
==============
reset command can be used to undo chnages at different levels
git reset <commit id>
git reset d0085530
git log
if you dont want the file git reset --hard d0085530
if you want the file git reset --soft d0085530 keep the files but head moves keep
the files not the commits