Just some brief post to reflect on my change from using Git from SourceTree to using Git from a terminal. What did I miss the most this past year?
Nothing at all! I do not miss SourceTree or any other GUI application at all. And in fact, I feel myself much more confident in working with Git now as well.
Approximately one year ago, I was really lucky to be part of a team where they worked in a very clean way and tried to keep the git history linear and clean. This was an eye opener to see how much more readable a git history can become. Of course it’s nice for us developers at that given project, but it is even much nicer for future developers joining the team. Since that change, one year ago, I didn’t use the git merge command either. Strange part is that if you would go 2 years back, I would never believe I would make this switch and stay with it.
This way of working is handy in both small as big projects.
My commits now matter and I don’t want merge commits in there as they are just clutter to me now. I am not interested in how many times I merged back in master or develop branch. I Only keep the commits that matter.
Advantages
-
One of the main advantages I see with this terminal approach is the fact that it will stay like this probably till I die. You don’t need to adapt to the newest GUI and menu changes that a tool is offering or forcing you. You can stay productive at all times.
-
Another one is that you really learn the differences between git commands like fetch and pull and much more. Because a GUI can combine and hide these subtle differences for you.
-
Speed! Working in terminal goes way faster with a proper
gitConfiguration
file.
Disadvantages
-
you need to type the command instead of clicking. I was lucky I could reuse one the team members their git alias configuration. That way, this disadvantage is no longer valid. I am now a lot faster than before when using a GUI to do my job.
-
install a proper terminal like iTerm to have the basic feature you need. It can display your current branch, indicate if something was changed and much more at the prompt.
Handy Git aliases
this simple configuration is to me the optimal one to let you make speed by typing less, but still keeps the magic happening behind low so you really understand what is happening.
[alias]
co = checkout
s = status --branch
l = !"git short-log"
p = !git push --set-upstream ${1-origin} HEAD
fp = !"git push origin HEAD --force-with-lease"
short-log = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)'
fuckit = !"git clean -d -f && git reset --hard"
Because of the extensive usage of commands like git commit --fixup <commitHash>
, I was also happy you could define autosquash
as default in the gitConfiguration it’s rebase section.
[merge]
ff = only
[rebase]
autosquash = true
Feel free to start from my .gitconfig on GitHub.