.gitconfig
file should be usedFor ease of use a unique .gitconfig
file should be used.
Also the file types that are forbidden to be checked into the Git repository should be defined for every body. It is not considered as a good practice to commit binary files in the Git ... but sometimes teams do.
The fact that the file with the alias is common/shared across the team(s) allows to exchange best practice & common behavior. It is however not mandatory, just an advice.
git ps
or git -p status
will provide the list of files that have been modified. The -p
stands for paginated. Pagination help to realise there are too many files modified.
The following command will show what has changed in the file since the last checkout
(or since the last git add
for that file).
git diff <file_name>
There is also the possibility to show the difference side-by-side. See the interesting post.
Once you have added all the files that you have modified for one change request, you should commit those.
The following will add all the translations for my project
git add ./locale/*/LC_MESSAGES/django.po
Avoid adding all the files at once with a command like : git add .
It work beautifully until you push too many files at once and end up with binary or you password file in you repository.
Attention : Once you add a file, you only add the modifications of the files in the scope for the next commit
.
The command is really simple and straight forward : git commit -m _<my usefull message>_
It is really crucial to put a meaningful message as it is what the users will have to quickly identify the commit that is of interested to them.
The typical command is git help <specific_command>
.
git help diff
Beware that the help is sometimes very long. Worst, the interesting command are not always in the beginning.
[user]
name = Thomas Lionel SMETS
email = Thomas.Smets@a3-system.eu
password = "<HIDDEN>"
[alias]
co = checkout
br = branch -a
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(black)%s%C(reset) %C(dim blue)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(black)%s%C(reset) %C(dim blue)- %an%C(reset)' --all
logs = log --oneline --pretty=format:"%h%x09%an%x09%ad%x09%s"
lg = !"git lg1"
ps = -p status
last = cat-file commit HEAD
st = status
ci = commit
pll = pull -v
ftch = fetch -v
[core]
excludesFile=~/.gitconfig-ignore
[pull]
rebase = true
*~
**/*.*.bak
**/*.*.BAK
**/logs
*.pdf