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.

Characteristics

  • 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

Installation/Setup

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

Chat

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
1730
votes
40 answers

How to specify the private SSH-key to use when executing shell command on Git?

A rather unusual situation perhaps, but I want to specify a private SSH-key to use when executing a shell (git) command from the local computer. Basically like this: git clone git@github.com:TheUser/TheProject.git -key…
Christoffer
  • 25,035
  • 18
  • 53
  • 77
1730
votes
38 answers

.gitignore is ignored by Git

My .gitignore file seems to be being ignored by Git - could the .gitignore file be corrupt? Which file format, locale or culture does Git expect? My .gitignore: # This is a comment debug.log nbproject/ Output from git status: # On branch master #…
Matt Parkins
  • 24,208
  • 8
  • 50
  • 59
1715
votes
9 answers

Hard reset of a single file

How do I discard the changes to a single file and overwrite it with a fresh HEAD copy? I want to do git reset --hard to only a single file.
Emiliano
  • 22,232
  • 11
  • 45
  • 59
1706
votes
32 answers

How can I Remove .DS_Store files from a Git repository?

How can I remove those annoying Mac OS X .DS_Store files from a Git repository?
John Topley
  • 113,588
  • 46
  • 195
  • 237
1699
votes
21 answers

How do I revert a merge commit that has already been pushed to remote?

git revert alone won't work. Apparently, -m must be specified.
Yaz
  • 17,126
  • 3
  • 16
  • 11
1659
votes
5 answers

Warning: push.default is unset; its implicit value is changing in Git 2.0

I've been using Git for a while now and have recently downloaded an update only to find this warning message come up when I try to push. warning: push.default is unset; its implicit value is changing in Git 2.0 from 'matching' to 'simple'. To…
Marko
  • 71,361
  • 28
  • 124
  • 158
1655
votes
24 answers

You have not concluded your merge (MERGE_HEAD exists)

I made a branch called 'f' and did a checkout to master. When I tried the git pull command I got this message: You have not concluded your merge (MERGE_HEAD exists). Please, commit your changes before you can merge. When I try the git status, it…
Ankit Suri
  • 16,490
  • 3
  • 16
  • 19
1653
votes
15 answers

How to fully delete a git repository created with init?

I created a git repository with git init. I'd like to delete it entirely and init a new one.
user105813
  • 17,059
  • 4
  • 21
  • 17
1637
votes
12 answers

Create a branch in Git from another branch

I have two branches: master and dev I want to create a "feature branch" from the dev branch. Currently on the branch dev, I do: git checkout -b myfeature dev ... (some work) git commit -am "blablabla" git push origin myfeature But, after…
revohsalf
  • 16,443
  • 3
  • 15
  • 4
1633
votes
16 answers

How do I remove a directory from a Git repository?

How can I delete a single directory containing files from a Git repository?
Sahat Yalkabov
  • 32,654
  • 43
  • 110
  • 175
1619
votes
15 answers

How do I show my global Git configuration?

I'd like to show all configured Git sections. I only found git config --get core.editor, and I'd like to output everything that's configured globally, not only the configured default editor.
wullxz
  • 17,830
  • 8
  • 32
  • 51
1615
votes
34 answers

How do I migrate an SVN repository with history to a new Git repository?

I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like: SVN repository in: svn://myserver/path/to/svn/repos Git repository in:…
Milan Babuškov
  • 59,775
  • 49
  • 126
  • 179
1609
votes
11 answers

How can I generate a Git patch for a specific commit?

I need to write a script that creates patches for a list of SHA-1 commit numbers. I tried using git format-patch , but that generated a patch for each commit since that SHA-1 value. After a few hundred patches were generated, I had to kill…
elle
  • 16,125
  • 3
  • 15
  • 4
1602
votes
16 answers

How can I view a git log of just one user's commits?

When using git log, how can I filter by user so that I see only commits from that user?
markdorison
  • 139,374
  • 27
  • 55
  • 71
1585
votes
20 answers

How can I undo git reset --hard HEAD~1?

Is it possible to undo the changes caused by the following command? If so, how? git reset --hard HEAD~1
Paul Wicks
  • 62,960
  • 55
  • 119
  • 146