Questions tagged [git]

Git is an open-source distributed version control system (DVCS). Use this tag for questions about Git usage and workflows. Do not use this tag for general programming questions that happen to involve a Git repository. Do not use this tag for GitHub/GitHub Actions questions that do not involve git usage; use [github] or [github-actions] instead. Do not use the [github] tag for Git-related issues just because a repository happens to be hosted on GitHub.

Git is an open-source distributed version control system () with an emphasis on speed. was initially designed and developed by Linus Torvalds for kernel development, now it is maintained by Junio Hamano.

Every Git working directory contains a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.

The latest stable version is 2.40.0, released on 13 March, 2023.


  • Strong support for non-linear development
  • Distributed development
  • Compatibility with existing systems/protocols
  • Efficient handling of large projects
  • Cryptographic authentication of history
  • Toolkit-based design
  • Pluggable merge strategies
  • Garbage accumulates unless collected
  • Periodic explicit object packing
  • Data Assurance

Data structures

git - data workflow

External Links

Internal Links


Working with the code

Tagging, branching, releases, baselines

Git Clients

  • msysgit - Cross platform, included with Git
  • gitk - Cross platform history viewer, included with Git
  • RepoZ - Zero-effort repository hub to track and access local Git repositories for Windows and macOS
  • gitnub - macOS
  • gitx - macOS history viewer
  • smartgit - Cross platform, commercial, beta
  • tig - console GUI for Linux
  • qgit - GUI for Windows, Linux
  • Git Extensions - package for Windows, includes friendly GUI
  • SourceTree - A free Git & Mercurial client for Windows or macOS
  • posh-git - A Windows PowerShell environment for Git
  • TortoiseGit - A Windows Explorer extension with overlay icons representing the file statuses in explorer
  • GitKraken - A fancy, cross-platform Git client
  • GitHub Desktop — A cross-platform client, primarily used for GitHub but works with other hosts

Other Git beginner's references

There are also good guides if you would like to understand Git conceptually or if you would like to compare other revision control software such as subversion.

Free Git hosting

Video Tutorial

Related tags


The Stack Overflow git chat is useful for coordinating work within this tag, and perhaps occasionally for getting quick help (though no guarantees can be made; attendance is spotty).

150148 questions
7 answers

How do I clone a specific Git branch?

Git clone will clone remote branch into local. Is there any way to clone a specific branch by myself without switching branches on the remote repository?
  • 41,923
  • 8
  • 26
  • 18
50 answers

How do I get the current branch name in Git?

How do I get the name of the current branch in Git?
  • 45,873
  • 18
  • 40
  • 57
13 answers

Move existing, uncommitted work to a new branch in Git

I started some work on a new feature and after coding for a bit, I decided this feature should be on its own branch. How do I move the existing uncommitted changes to a new branch and reset my current one? I want to reset my current branch while…
Dane O'Connor
  • 75,180
  • 37
  • 119
  • 173
14 answers

Remove a file from a Git repository without deleting it from the local filesystem

I want to remove a file from my repository. git rm file_to_remove.txt will remove the file from the repository, but it will also remove the file from the local file system. How do I remove this file from the repo without deleting my local copy of…
  • 38,827
  • 3
  • 22
  • 14
27 answers

View the change history of a file using Git versioning

How do I view the history of an individual file with complete details of what has changed? git log -- [filename] shows me the commit history of a file, but how do I see the file content that changed?
  • 39,052
  • 6
  • 25
  • 29
32 answers

How do I stash only one file out of multiple files that have changed?

How do I stash only one of the multiple changed files on my branch?
  • 100,387
  • 116
  • 269
  • 365
25 answers

How do I create a remote Git branch?

I created a local branch. How do I push it to the remote server? UPDATE: I have written a simpler answer for Git 2.0 here.
Jesper Rønn-Jensen
  • 106,591
  • 44
  • 118
  • 155
32 answers

Git refusing to merge unrelated histories on rebase

During git rebase origin/development the following error message is shown from Git: fatal: refusing to merge unrelated histories Error redoing merge 1234deadbeef1234deadbeef My Git version is 2.9.0. It used to work fine in the previous version.…
Shubham Chaudhary
  • 47,722
  • 9
  • 78
  • 80
29 answers

Commit only part of a file's changes in Git

When I make changes to a file in Git, how can I commit only some of the changes? For example, how could I commit only 15 lines out of 30 lines that have been changed in a file?
  • 57,041
  • 28
  • 76
  • 106
30 answers

How do I list all the files in a commit?

How can I print a plain list of all files that were part of a given commit? Although the following lists the files, it also includes unwanted diff information for each: git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
Philip Fourie
  • 111,587
  • 10
  • 63
  • 83
12 answers

Difference between "git add -A" and "git add ."

What is the difference between git add [--all | -A] and git add .?
  • 113,384
  • 42
  • 163
  • 163
38 answers

Git is not working after macOS update ("xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools")

I updated to the latest OS, and/or restarted my computer (this happens on every major update, but this time all I did was restart my computer on 2022-09-13). This morning I navigated to my work's codebase in the command line on my MacBook Pro, typed…
  • 79,958
  • 7
  • 21
  • 41
13 answers

How do you push a tag to a remote repository using Git?

I added a tag to the master branch on my machine: git tag mytag master How do I push this to the remote repository? Running git push gives the message: Everything up-to-date However, the remote repository does not contain my tag.
  • 121,568
  • 97
  • 310
  • 388
34 answers

How do I make git use the editor of my choice for editing commit messages?

How do I globally configure git to use a particular editor (e.g. vim) for commit messages?
  • 76,030
  • 23
  • 64
  • 76
14 answers

What does cherry-picking a commit with Git mean?

What does git cherry-pick do?
  • 44,892
  • 25
  • 73
  • 103