Académique Documents
Professionnel Documents
Culture Documents
Wibowo Arindrarto
We have only been playing with some of what git offers. In reality,
you can do much more with it. It also allows for a wide array of
customizations.
Checking which branch you are working on and its status is routine.
Checking which branch you are working on and its status is routine.
Checking which branch you are working on and its status is routine.
The location of this file depends on your OS and git version. For
now, you can download a copy of this file from our GitLab.
The location of this file depends on your OS and git version. For
now, you can download a copy of this file from our GitLab.
git blame
Git tracks each line of each file in its repository.
git blame
Git tracks each line of each file in its repository.
You can view who committed the line change, the commit hash, and
the commit time using “git blame”.
1 $ git blame README
2 a4394d28 ( bow 2014 -06 ...) Second version .
git blame
Git tracks each line of each file in its repository.
You can view who committed the line change, the commit hash, and
the commit time using “git blame”.
1 $ git blame README
2 a4394d28 ( bow 2014 -06 ...) Second version .
git tag
Sometimes, it is practical to refer to a commit with a name instead
of a hash.
git tag
Sometimes, it is practical to refer to a commit with a name instead
of a hash.
git tag
Sometimes, it is practical to refer to a commit with a name instead
of a hash.
git tag
git tag
What we did previously is to add what is called a lightweight tag.
Lightweight tags are essentially commit aliases.
git tag
What we did previously is to add what is called a lightweight tag.
Lightweight tags are essentially commit aliases.
git tag
What we did previously is to add what is called a lightweight tag.
Lightweight tags are essentially commit aliases.
git tag
1 $ git tag -a " v0 .0.1" -m " Alpha version "
2 tag v0 .1.0
3 Tagger : bow < bow@bow . web . id >
4 Date : Sat Jun 21 15:11:53 2014 +0200
5
6 Alpha version
7
8 commit a 4 3 9 4 d 2 8 e 6 b a 3 0 b e 1 9 3 1 8 e e 7 4 f 7 3 2 a 1 0 3 b 8 f f d f 2
9 Author : bow < bow@bow . web . id >
10 Date : Sat Jun 21 13:47:03 2014 +0200
11
12 Second commit
13
14 diff -- git a / README b / README
15 index efe6f7c ..4 fe6328 100644
16 --- a / README
17 +++ b / README
18 @@ -1 +1 @@
19 - First version .
20 + Second version .
git diff -w
Sometimes, you want to hide whitespace differences when using
“git diff”.
git diff -w
Sometimes, you want to hide whitespace differences when using
“git diff”.
git diff -w
Sometimes, you want to hide whitespace differences when using
“git diff”.
Note that while this aids visualization of the diff, git will still commit
the whitespace change.
Still, there are times when changing that one last commit makes
more sense than doing a “git revert”
Still, there are times when changing that one last commit makes
more sense than doing a “git revert”
“git commit --amend” allows you to do that: changing your last com-
mit.
You can also use the command to meld current staged changes to
your last committed change.
1 $ git status
2 Changes to be committed :
3 modified : README
4 $ git commit -- amend -m " Update README "
5 [ master b60437d ] Second update
6 1 file changed , 1 insertion (+) , 1 deletion ( -)
At the end of the day, only “git commit -am "Updates"” is done and
the whole change is saved in a single comit.
At the end of the day, only “git commit -am "Updates"” is done and
the whole change is saved in a single comit.
Viewing
In Linux, git uses the “~/.gitconfig” file as its main configuration
file.
Viewing
In Linux, git uses the “~/.gitconfig” file as its main configuration
file.
Modifying
To edit the file directly, open “~/.gitconfig” in a text editor and
save your changes.
1 $ vim ~/. gitconfig
Modifying
To edit the file directly, open “~/.gitconfig” in a text editor and
save your changes.
1 $ vim ~/. gitconfig
You can also use the “git config --global” to set the values via the
shell.
1 $ git config -- global user . name " Linus Torvalds "
1 $ echo " Is this the real life ?" > this . out
2 $ touch testing . txt
3 $ git status
4 nothing to commit , working directory clean
Aliases
You can alias simple commands.
1 $ git config -- global alias . st status
2 $ git st
3 nothing to commit , working directory clean
Aliases
You can alias simple commands.
1 $ git config -- global alias . st status
2 $ git st
3 nothing to commit , working directory clean
Demo time!
Martijn Vermaat
Wibowo Arindrarto
Szymon Kielbasa
Jeroen Laros
http://git-scm.com/book