Results: 102
If we want to commit only part of changes of the same file
--patch
or
-p
is used
git add --patch
Similar to the above command
git add -p
Possible answers for the command:
y
stage this hunk for the next commit
n
do not stage this hunk for the next commit
q
quit; do not stage this hunk or any of the remaining hunks
a
stage this hunk and all later hunks in the file
d
do not stage this hunk or any of the later hunks in the file ... The complete list of the possible answers is on the link of the note
Cache credentials
Sets the cache timeout for 3600 seconds
git config --global credential.helper 'cache --timeout=3600'
After the command
git commit
->
i
- to jump into insert mode ->
esc
- takes us out of insert mode ->
:w
- to save written comment ->
:q
- to quit ------------------------
:w
and
:p
can be combined into
:wq
git alias
Creates alias
adog
globally
git config --global alias.adog "log --all --decorate --oneline --graph"
Which can lately be run using the follwing command
git adog
After the command execution, In global
config
file will be added the following
[alias]
	adog = log --all --decorate --oneline --graph
If we made changes in a file, that already was in staging area, the latest changes will not be considered if we commit the file, without adding the file in staging again
Git can tell us:
On which day we change which files
Git will even show us which lines of code we added and which lines of code we removed
The command below makes Git
forget
about
test.php
that was tracked but is now in
.gitignore
git rm --cached test.php
The command makes Git
forget
about all files under
docs
directory that was tracked but is now in
.gitignore
git rm -r --cached docs/
Moves
file.php
to
src
directory (if the directory does not exist, the file will be renamed to
src
)
git mv file.php src
file.php
will be moved to
src/
directory (if the destination directory does not exist, git will throw the error:
destination directory does not exist..
git mv file.php src/
After running the command, status of the file will be
renamed
, but if we did it manually, git will identify the operation as
deleted
and
new file
Stops the bisect process
git bisect reset
The bisect process needs to know which commit is our known bad commit
git bisect bad urhsn47f
If we don't specify the known bad commit it will assume the last commit
git bisect bad
Results: 102