Essential Git shortcuts

- 141 palabras - 1 minuto(s) tiempo de lectura
Git Python

While doing something in Python, I use Git to track versions and branches on each project.  These three shortcuts have saved me some typing in the shell:

alias g='git status'
alias gl='git log'
alias gd='git diff'

g displays the current branch name and which files are modified, or simply:

# On branch master
nothing to commit (working directory clean)

gl displays the commit log, which I check before doing a commit to standardize the messages.  gl -p shows the diffs for each commit in the log, and gl somefilepath shows the commit log for that file or the files inside a folder.  Combine the last two for the history of changes on a given file or folder.

gd shows the changes, I use it a lot to check if enough modifications have been done and it is time for a commit.