Table of contents

Notes on GIT

I’m not using git often enough to be confortable with uncommon utilizations. Here are some notes about what I’ve trouble to remember.

Acting on the worktree and the stage (aka index)

Acting on the current branch

Changing the branch

If the work tree of the stage are not equivalent to HEAD, additional options are needed to proceed:

Diff

-- can often be omitted if the file hasn’t the same name as a commit.

remote/HEAD

When cloning a repository, there is a HEAD created in the remote branch which points to the HEAD branch at the time when you did the clone. AFAIK, git does not change it implicitly as part of any synchronization afterwards. You can change it with the command

git remote set-head remotename remotebranch

There are some options (-a to get the current value from the remote, -d to delete it).

It allows some commands (I use that possibility with log and diff) to refer to that branch with just the remote name.

Notes

git switch and git restore are intended to replace git checkout and provides the same functionalities with a clearer use model.