Git
The one and only git - with the usual commands I often use.Commands, config settings and how I am using git to help me take care of business.
Git is a distributed version control system. In comparison to subversion, this means that several locations can serve as a distribution point.
Config settings #
Pretty oneliner log #
The first setting defines an alias for a pretty log, which gives me a nice overview over resent history.
|
|
Then git lol
gives a nice colorful log of all branches. Ommit --all
if only the current branch is of interest. --graph
shows the merges to the left side. The remaining arguments are my preferences and are documented in the git manual.
Working with remotes #
|
|
Those settings remove the need to always set the tracking manually. The last line removes local branches that are merge and removed on the remote - as it is the case in pull requests.
Ignoring whitespace differences #
|
|
Especially on Windows the changing line endings are a nightmare. Most languages are not indent aware, hence reformatting the code often results in large commits.
Commands #
Branches #
I used git branch -b <new branch>
before, but now am using git switch -c <new branch>
instead. Switching between branches is best done with git switch <branch name>
as it is more intuitive.
Adding files #
git add -A -n
shows which files would be added by the command git add -A -v
.
Pruning #
git pull -p
cleans the local list of branches and removes those that no longer exist on the remote side.