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
184
votes
29 answers

Change remote repository credentials (authentication) on Intellij IDEA 14

I recently changed my Bitbucket password for security reasons. However, IntelliJ didn't update my repository to the new credentials, so it stops me from pulling/pushing anything to my repository. I am not using any plugins for this, just the…
Momo
  • 3,542
  • 4
  • 21
  • 34
184
votes
5 answers

How to modify a pull request on GitHub to change target branch to merge into?

I have a pull request that is requesting a merge into master from my branch, but the owner wants me to change the request to merge into a different branch from my branch. Is this possible? What are the possible solutions?
Moriarty
  • 2,067
  • 2
  • 11
  • 13
184
votes
9 answers

Using git, how do I ignore a file in one branch but have it committed in another branch?

I've got a project that I'm deploying to Heroku. The source code tree includes a bunch of mp3 files (the website will be for a recording project I was heavily involved with). I'd like to put the source code for it up on GitHub, but GitHub has a…
Myron Marston
  • 21,452
  • 5
  • 64
  • 63
184
votes
6 answers

Is it possible to perform a 'grep search' in all the branches of a Git project?

Is it possible to run git grep inside all the branches of a Git control sourced project? Or is there another command to run?
epsilones
  • 11,279
  • 21
  • 61
  • 85
183
votes
14 answers

Fully backup a git repo?

Is there a simple way to backup an entire git repo including all branches and tags?
Daniel Upton
  • 5,561
  • 8
  • 41
  • 64
183
votes
9 answers

git: 'lfs' is not a git command unclear

Every time I enter in my command window git lfs install the message I get is git: 'lfs' is not a git command. See 'git --help'. I tried looking up for a solution, but none of the answers were clear. Can someone explain clear how to fix this?
bockdavidson
  • 2,083
  • 3
  • 14
  • 21
183
votes
10 answers

Maintain git repo inside another git repo

Here's what I'd like: REPO-A /.git /otherFiles /REPO-B /.git /moreFiles I want to be able to push all of REPO-A's contents to REMOTE-A and only REPO-B to REMOTE-B. Possible?
adamyonk
  • 2,976
  • 4
  • 22
  • 23
183
votes
5 answers

How to use Visual Studio Code as the default editor for Git MergeTool including for 3-way merge

Today I was trying to use the git mergetool on the Windows command prompt and realized that it was defaulting to use Vim, which is cool, but I'd prefer VS Code. How can I have Visual Studio Code function as my GUI for handling merge conflicts (or…
Eric D. Johnson
  • 10,219
  • 9
  • 39
  • 46
183
votes
4 answers

Differences between Commit, Commit and Push, Commit and Sync

I'm using visual studio 2013, and I'm faced with 3 options for when I commit my C# code. I need an explanation of the differences between each of the options with regards to what happens to my local repo vs. the GitHub repo. Option 1 says…
Alfred Waligo
  • 2,809
  • 3
  • 18
  • 26
183
votes
30 answers

How to clone all projects of a group at once in GitLab?

In my GitLab repository, I have a group with 20 projects. I want to clone all projects at once. Is that possible?
Doon
  • 3,339
  • 5
  • 25
  • 31
183
votes
3 answers

git shallow clone (clone --depth) misses remote branches

After cloning a remote repository it does not show any remote branch by -a option. What could be the problem? How to debug it? In this snippet two of the remote branches are not shown: $ git clone --depth 1…
minghua
  • 5,981
  • 6
  • 45
  • 71
183
votes
5 answers

How can I format patch with what I stash away

In git, I stash away my changes. Is it possible that I can create a patch with what I stash away? And then apply that patch in some other repository (my co-worker's)? I know git format-patch -1, but I think that it's for what I have committed. But…
silverburgh
  • 8,659
  • 10
  • 31
  • 24
183
votes
10 answers

Checkout subdirectories in Git?

Is it possible to check out subdirectories of a repository in Git? Imagine I am setting up a new WordPress installation. I will create two new directories for my plugin and theme customization: wordpress/wp-content/plugins/myplugins/…
Annika Backstrom
  • 13,937
  • 6
  • 46
  • 52
183
votes
4 answers

How to locate the git config file in Mac

As title reads, how to locate the git config file in Mac? Not sure how to find it. Need to set git config --global http.postBuffer 524288000 Need some guidance on finding it..
lakshmen
  • 28,346
  • 66
  • 178
  • 276
183
votes
23 answers

Cannot push to Git repository on Bitbucket

I created a new repository and I'm running into a strange error. I've used Git before on Bitbucket but I just reformatted and now I can't seem to get Git to work. After doing a commit, I had to add my email and name to the globals, but then it…
Jason Dahl
  • 1,939
  • 2
  • 13
  • 6