First Step - Configure your Git
So, the first thing you need to do is configure your Git globally, using --global
. That means these configurations will be shared through all projects in your machine. If you don’t pass the --global
option, git will override these configurations inside the project you’re on.
1
2
$ git config --global user.name "Your Name"
$ git config --global user.email "your.name@rmail.com"
Your name and email. This will be attached to every commit you make, and most (if not all) of Git servers use the email configured to link things to your user, Like Atlassian, Github, Gitlab and so on.
1
2
$ git config --global alias.lg "log --graph --abbrev-commit --decorate --date=iso --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%cd)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --since=7.days"
$ git config --global alias.st "status -sb"
And aliases. Aliases are short for commands, basically. you can do almost whatever you want with aliases, using Git commands or even commands outside Git.
git lg
will show the git log, but with some shenanigans. the important parts of this commands are: --graph
that will show a graph for the commits, a line showing the commit history, and --since=7.days
, that will show the commits for the last 7 days. You can override this by specifying it again, and put whatever you want, like this: git lg --since=4.weeks
, or git lg --since=2.years
.
Although it’s very basic, this will help you a lot through the project.
Next post will be about initializing a Git repos.
Bye ::]