Git: Detached HEAD – Go Back – [Fixed]

“You are in ‘detached HEAD’ state” is not an error message and is nothing to be worried about.

This state means you are no longer on a branch, and it happens when an arbitrary commit is checked out instead of a branch.

If this state was unintentional and you want to “fix” the ‘detached HEAD’, you can go back to the branch you are expected to be on by runing the git checkout command. (more…)

Git: Create Tag & Push Tag to Remote

Tags in Git are used to label specific commits (to mark releases, for example).

In this note i will show how to create a Git tag and push it remote repository using the git tag and git push commands.

I will also show how to find out the most recent tag name and how many commits ago it has been created. (more…)

Git – Show Config – List Global & Local Settings

Git stores configuration data in three different scopes: local, global and system.

Using the git config command we can list all Git config settings as well as only local, global or system settings.

For each scope, Git stores settings in different config files and it may be useful to know how to locate those files.

In this note i am showing how to list Git config settings and how to find Git config files location. (more…)

Git – Verbose Mode: Debug Fatal Errors

Sometimes it may be complex to debug Git errors, like “fatal: repository not found” or “fatal: authentication failed” with the default level of verbosity in Git.

To debug different network, security, performance and many other issues in Git it is very helpful to know how to increase verbosity.

In this note i am showing how to debug Git issues from the command line by increasing verbosity of Git commands in Linux, MacOS and Windows. (more…)

Git – Remove All Commits – Clear Git History (Local & Remote)

In this article i am showing how to clear Git history by removing all commits.

You may need this if you want to delete sensitive data from the history of Git commits.

After such cleanup you will have the latest version of your Git repository, but with the one commit only.

Be aware that after resetting all the history of changes in your Git repository will be deleted as well. (more…)