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
5 answers

Git: Set up a fetch-only remote?

When I run git remote -v in one of my Git repositories that has a remote(s) configured, I see that each remote has both fetch and push specs: $ git remote -v ssh://host/path/to/repo (fetch) ssh://host/path/to/repo…
  • 2,900
  • 3
  • 23
  • 24
5 answers

How to switch back to 'master' with git?

I have made my first commit; then created a branch (let's say branch1). In this branch I've created a directory 'example' and commited. In GitHub I see my new branch and the new directory 'example' that I have added. Now I wonder how can I 'sync'…
  • 4,226
  • 11
  • 58
  • 76
7 answers

Combining Multiple Commits Into One Prior To Push

This question pertains not only to how to accomplish this task, but to whether doing so is good or bad practice with Git. Consider that locally I do most work on the main branch, but I have created a topical branch I will call feature_branch. In the…
Todd Hopkinson
  • 6,803
  • 5
  • 32
  • 34
5 answers

Can "git pull" automatically stash and pop pending changes?

I know how to solve this: user@host$ git pull Updating 9386059..6e3ffde error: Your local changes to the following files would be overwritten by merge: Please, commit your changes or stash them before you can merge. Aborting But isn't…
  • 25,042
  • 81
  • 346
  • 663
9 answers

Best way to add Gradle support to IntelliJ Project

I have looked around quite a bit and haven't found the best solution to convert an existing IntelliJ project to Gradle. I work in a team environment and we currently share the .ipr file as we have a few build configurations that we track. We will be…
  • 8,158
  • 6
  • 30
  • 44
37 answers

Git push hangs when pushing to Github?

Git push hangs everytime I try to push to github. I am using Cygwin and Windows 7. Git functions fine locally tracking branches, providing status, setting global and and allowing commits. I'm still new and learning. I enter git…
Matt Singer
  • 1,917
  • 2
  • 14
  • 12
5 answers

What is a patch in Git version control?

I am new to both Git and version control so I am trying to figure out what a patch is and how is it different from the rest of activities I do in Git? When do I apply a patch? Does it happen every time I commit?
Amit Erandole
  • 11,995
  • 23
  • 65
  • 103
18 answers

Can I restore deleted files (undo a `git clean -fdx`)?

I was following the instructions on making github pages, and forgot to move down into my git sub directory. As a result, I just nuked an entire directory of documents with git clean -fdx. Is there any way I can undo this terrible mistake?
  • 95,302
  • 53
  • 242
  • 374
3 answers

git diff between cloned and original remote repository

I have cloned a github repository and made no changes locally. Github repository moved forward with commits on the same branch. How do I find a diff between my local repository and the original github repository? How do I find a diff between my…
Delta George
  • 2,560
  • 2
  • 17
  • 11
10 answers

Can I store the .git folder outside the files I want tracked?

I have an unusual idea to use git as a backup system. So let's say I have a directory ./backup/myfiles and I want to back that up using git. To keep things clean I don't want to have a .git directory in the myfiles folder, so I thought I could…
  • 58,203
  • 71
  • 188
  • 248
15 answers

How to discard all changes made to a branch?

I'm working in a branch (i.e. design) and I've made a number of changes, but I need to discard them all and reset it to match the repository version. I thought git checkout design would do it, but it just tells me I'm already in branch design and…
  • 5,370
  • 9
  • 35
  • 48
14 answers

How can I easily fixup a past commit?

I just read amending a single file in a past commit in git but unfortunately the accepted solution 'reorders' the commits, which is not what I want. So here's my question: Every now and then, I notice a bug in my code while working on an (unrelated)…
Frerich Raabe
  • 90,689
  • 19
  • 115
  • 207
7 answers

How to undo a successful "git cherry-pick"?

On a local repo, I've just executed git cherry-pick SHA without any conflicts or problems. I then realized I didn't want to do what I just did. I have not pushed this anywhere. How can I remove just this cherry pick? I'd like to know if there's a…
Brad Parks
  • 66,836
  • 64
  • 257
  • 336
5 answers

How do .gitignore exclusion rules actually work?

I'm trying to solve a gitignore problem on a large directory structure, but to simplify my question I have reduced it to the following. I have the following directory structure of two files (foo, bar) in a brand new git repository (no commits so…
  • 12,528
  • 9
  • 64
  • 96
5 answers

git checkout all the files

How can I get rid of all the changes in all the files of my repository? Say I am in a branch and I did some changes. git status returns a set of files in the "Changes not staged for commit" and I notice I would like to get rid of all of these…
  • 275,237
  • 103
  • 548
  • 598
1 2 3