user@host project $ git branch crazyidea
user@host project $ git checkout crazyidea
user@host project $ git status
It will state which branch is checked out, make sure it's crazyidea
.
Modify both lines of file1.txt
and add a third line:
Oxygens are red.
Nitrogens are blue.
In Cryo-EM everything is grey.
user@host project $ git add file1.txt
user@host project $ git commit -m "change to elements"
user@host project $ git log --all --decorate --oneline --graph
Each commit is one line.
HEAD points to the commit that is checked out (the latest commit).
The crazyidea
branch points to the latest commit.
The master
branch is still pointing to second commit.
In this case, merging is equivalent to updating the master
branch to point to the latest commit.
user@host project $ git checkout master
user@host project $ git merge crazyidea
user@host project $ git log --all --decorate --oneline --graph
user@host project $ git branch beautify
user@host project $ git checkout beautify
Change everything
to all
in the third line of file1.txt
.
user@host project $ git add file1.txt
user@host project $ git commit -m "improve wording"
user@host project $ git status
user@host project $ git adog
user@host project $ git checkout master
user@host project $ git adog
Change grey
to gray
in the third line of file1.txt
:
user@host project $ git add file1.txt
user@host project $ git commit -m "changed to gray"
user@host project $ git adog
Consider the following commit graph
* 82e34e7 (HEAD, master) changed to gray
| * 8b3c5d6 (beautify) improve wording
|/
* 362bffc change to elements
* 62fbfe6 roses to tomatoes
* 758fe9d initial draft of mock text
We can look at the differences between master
and beautify
with either of these two commands:
user@host project $ git difftool -t vimdiff master beautify
user@host project $ git difftool -t vimdiff 8b3c5d6 82e34e7
There will be conflicts, which need to be manually resolved.
Roses are red.
Nitrogens are blue.
<<<<<<< HEAD
In Cryo-EM everything is gray.
=======
In Cryo-EM all is grey.
>>>>>>> test