Search notes:

Git

Git das not store changes, but states. Git doesn't care about encodings, it just tracks bytes.
Commands operate on the history of the current branch.

Branches

Show current branch

git branch
Prints a list of local branches of the repo. The current branch is prefixed with a star.

List current set of branches

git branch -a

Delete a branch

git branch -d name-of-branch
If branch not fully merged:
git branch -D name-of-branch

Configuration

git config ...
Three files involved: ~/.gitconfig, .git/config, $(prefix)/etc/gitconfig. (Where is $(prefix) defined?)

git behind a firewall

Windows

c:\> set HTTP_PROXY=http://DOMAIN\\USER.NAME/192.168.1.100:8080
c:\> git config --global http.proxy %HTTP_PROXY%

git init

git init
Creates a new repository.
Files and directories created
This new repository contains one branch: master / main.

git log

Shows commit (id, author, timestamp) made in the repository.

Configuration files

Porcelain commands

Git has three levels of configuration files that can change the output of porcelain commands:
  • $prefix/etc/gitconfig
  • ~/.gitconfig
  • $XDG_CONFIG_HOME/git/config

Tuomo Valkonen's on Git

Tuomo Valkonen's quote somewhat resonates with me:
I will not touch Git with a long stick. It is the Microsoft Word of version control systems: a massive waste of time, a fiddly piece of junk, that for reasons unfathomable found its way everywhere. I have much better uses for my brain cells and time than to study for a PhD in gitology, prerequisite for using a tool that gets in the way of doing the job instead of simply doing it. If you want to work with me, you have to use a well-designed, user-friendly, modern version control system, such as Mercurial, Darcs, or Fossil — almost anything but Git!

TODO

Windows / core.autoclrf

I have the strong impression that I am better off configuring git on Windows with a false core.autoclrf:
git config --global core.autocrlf false

Executable bit

Git not only tracks file content but also the files' executable bits (on file systems that support it, that is).
There are two modes that git is a able to assign to a file: 100644 for regular files and 100755 for executable files.
The mode of a file can be shown with
git ls-files  -s  bin/build.sh
This bit can be modified with
git update-index  --chmod=+x  bin/build.sh
See also the core.filemode option.

Empty directories / .gitkeep

Git is unable to track empty directories.
In order to mark a directory as «logically empty», a convention is to put (a zero size) file named .gitkeep into the directory.
Of course, the directory is then not empty anymore, but people familiar with this convention at least recognize that the directory is supposed to be empty.

See also

man gitrepository-layout
git internals
Perl module: Git::Repository.
/usr/lib/git-core
Git protocols
HKEY_CURRENT_USER\Software\GitForWindows
Git is supported in Azure Repos.

Index