Questions tagged [git]

Git is an open-source distributed version control system (DVCS). Use this tag for questions related to Git usage and workflows. DO NOT USE the [github] tag for Git-related issues simply because a repository happens to be hosted on GitHub. Also, do not use this tag for general programming questions that happen to involve a Git repository.

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.33.1, released on 12 October, 2021.


  • 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).

140018 questions
98 answers

How do I undo the most recent local commits in Git?

I accidentally committed the wrong files to Git but didn't push the commit to the server yet. How can I undo those commits from the local repository? The only way seems to be to copy the edits in some kind of GUI text editor, then wipe the whole…
Hamza Yerlikaya
  • 48,189
  • 40
  • 139
  • 234
41 answers

How do I delete a Git branch locally and remotely?

I want to delete a branch both locally and remotely. Failed Attempts to Delete a Remote Branch $ git branch -d remotes/origin/bugfix error: branch 'remotes/origin/bugfix' not found. $ git branch -d origin/bugfix error: branch 'origin/bugfix' not…
Matthew Rankin
  • 424,668
  • 38
  • 118
  • 160
38 answers

What is the difference between 'git pull' and 'git fetch'?

What are the differences between git pull and git fetch?
  • 264,618
  • 120
  • 339
  • 573
37 answers

How do I undo 'git add' before commit?

I mistakenly added files to Git using the command: git add myfile.txt I have not yet run git commit. Is there a way to undo this, so these files won't be included in the commit?
  • 143,025
  • 26
  • 88
  • 126
36 answers

How do I rename a local Git branch?

I don't want to rename a remote branch, as described in Rename master branch for both local and remote Git repositories. How can I rename a local branch which hasn't been pushed to a remote repository? In case you need to rename a remote branch as…
  • 111,363
  • 20
  • 71
  • 107
48 answers

How do I force "git pull" to overwrite local files?

How do I force an overwrite of local files on a git pull? The scenario is the following: A team member is modifying the templates for a website we are working on They are adding some images to the images directory (but forgets to add them under…
Jakub Troszok
  • 90,015
  • 10
  • 37
  • 51
39 answers

How do I check out a remote Git branch?

Somebody pushed a branch called test with git push origin test to a shared repository. I can see the branch with git branch -r. Now I'm trying to check out the remote test branch. I've tried: git checkout test which does nothing git checkout…
Juri Glass
  • 80,959
  • 8
  • 32
  • 46
27 answers

How to modify existing, unpushed commit messages?

I wrote the wrong thing in a commit message. How can I change the message? The commit has not been pushed yet.
Laurie Young
  • 132,296
  • 13
  • 46
  • 54
41 answers

How do I revert a Git repository to a previous commit?

How do I revert from my current state to a snapshot made on a certain commit? If I do git log, then I get the following output: $ git log commit a867b4af366350be2e7c21b8de9cc6504678a61b` Author: Me Date: Thu Nov 4 18:59:41 2010…
Crazy Serb
  • 76,390
  • 8
  • 33
  • 46
41 answers

How to remove local (untracked) files from the current Git working tree

How do you delete untracked local files from your current working tree?
  • 321,454
  • 105
  • 202
  • 204
31 answers

How can I make Git "forget" about a file that was tracked, but is now in .gitignore?

There is a file that was being tracked by Git, but now the file is on the .gitignore list. However, that file keeps showing up in git status after it's edited. How do you force Git to completely forget about it?
  • 85,778
  • 15
  • 48
  • 57
20 answers

Move the most recent commit(s) to a new branch with Git

I'd like to move the last several commits I've committed to master to a new branch and take master back to before those commits were made. Unfortunately, my Git-fu is not strong enough yet, any help? I.e. How can I go from this master A - B - C - D…
Mark A. Nicolosi
  • 76,625
  • 10
  • 43
  • 46
37 answers

How do I discard unstaged changes in Git?

How do I discard changes in my working copy that are not in the index?
  • 321,454
  • 105
  • 202
  • 204
34 answers

How can I reset or revert a file to a specific revision?

I have made some changes to a file which has been committed a few times as part of a group of files, but now want to reset/revert the changes on it back to a previous version. I have done a git log along with a git diff to find the revision I need,…
  • 62,079
  • 6
  • 30
  • 37
36 answers

How to resolve merge conflicts in a Git repository?

I want to resolve merge conflicts in my Git repository. How can I do that?
  • 115,720
  • 43
  • 136
  • 157
2 3
99 100