Questions tagged [git]

is for Emacs support of Git, the distributed version control system. Emacs `version-control` feature supports many systems besides Git. Additional extensions, such as `Magit`, also provide extensive Git support. Therefore use additional tags besides `git` for Git related questions.

Git is an open-source distributed version control system (DVCS) with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux 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.

There are many resources and tutorials available free online for Git beginners; see the bottom of this page for links to some of these resources.

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 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
  • gitnub - Mac OS X
  • gitx - Mac OS X 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 Mac
  • posh-git - A Windows PowerShell environment for Git

Any other common tasks a beginner should know?

Other Git beginner's references

Delving into Git

Comparison of revision control software

262 questions
118
votes
3 answers

How to merge Git conflicts in Emacs

My recent Git merge has resulted in a large number of conflicts. My current approach is to search for the next occurence of '<<<' and then perform the merge by standard text editing. Question: is there a way Emacs can support merging using the…
Beginner
  • 2,661
  • 3
  • 17
  • 25
68
votes
2 answers

How can I open a specific revision of a file with Magit?

Is it possible to open a specific revision of a file in Emacs with Magit without changing the current branch? I have rebased some local changes to a revision where the modified functions were replaced by functionality in a different file. I would…
David Holm
  • 1,179
  • 1
  • 10
  • 10
67
votes
4 answers

Add change to a previous commit with Magit

I have 2 commits, A then B, ready to be pushed. I realize I forgot to add something in A. How can I add this change to A using Magit? I don't even know which part of the Git documentation I should look at.
Mathieu Marques
  • 1,953
  • 1
  • 13
  • 30
62
votes
3 answers

What's the Magit equivalent of 'git add'?

What is the Magit equivalent of git add [--intent-to-add] for checking a newly created file into Git?
feoh
  • 900
  • 1
  • 6
  • 9
61
votes
1 answer

Can I checkout a given commit from magit's log view?

I'm exploring a git repository history using magit's log view using l l. Can I checkout a given commit from there without going to terminal?
Rafa de Castro
  • 1,231
  • 10
  • 14
57
votes
5 answers

Change a branch's upstream with Magit

When you push a branch with Magit (with P P) and the branch has no upstream, Magit asks you the name of the branch you want to push to. That's great. Once you set the upstream for a branch, however, Magit no longer asks you where you want to push…
Malabarba
  • 22,878
  • 6
  • 78
  • 163
49
votes
2 answers

How can I discard changes to unstaged files using magit?

Is there a way to issue the command: git checkout NameOfFile on a modified and unstaged file from within MAGIT?
user2522280
  • 939
  • 2
  • 7
  • 13
33
votes
3 answers

Untrack file without deleting it?

I have a tracked file in a git repository. How do I untrack this file without deleting it using magit?
deadghost
  • 807
  • 1
  • 7
  • 13
28
votes
1 answer

Choose files to stage of a new directory with magit

If you create a new directory, its files won't show up with magit-status, only the new directory is in the list of Untracked items. Currently I have to magit-stage-item the new directory and then remove unwanted files from the stage area. Is there…
marcanuy
  • 798
  • 6
  • 20
27
votes
2 answers

How can I list available tags in Magit?

I would like to list the available tags in Magit in order to diff a specific revision, is this possible? Specifically what I am after is to list the revision history at a certain tag and then view the diff for one of the patches in its history. I…
David Holm
  • 1,179
  • 1
  • 10
  • 10
22
votes
2 answers

How to automatically sign commits with magit?

I'm interested on having each of my commits signed with my GPG key. Since I use magit for interfacing with git, I was wondering if telling magit to sign each commit was possible (or some workaround to achieve this was feasible, at least).
shackra
  • 2,702
  • 18
  • 47
20
votes
1 answer

Magit - Undo last commit - History Manipulation

This StackOverflow question has the best solutions/approaches to undo last commits. I started using Magit a couple a weeks ago and after looking through all its documentation I still don't have a definitive/best way to undo a mistakenly committed…
18
votes
3 answers

How to start ediff-ing a file that has git conflict markers in it?

Following an attempted git merge on the commandline, my file now has standard conflict markers in it which emacs has helpfully reloaded (reverted?) in the buffer. How do I start some kind of merging mode to resolve the conflict? Can I get seperate…
daiboo
  • 181
  • 3
18
votes
2 answers

How can I use emacs with git within the terminal?

I've used git config --global core.editor emacs to set my git editor as emacs but when I do that and commit something the editor opens up a new window instead of opening emacs within the terminal. I want to use emacs as if -nw were given to it but…
MarMar
  • 183
  • 1
  • 1
  • 5
18
votes
3 answers

Magit extremely slow in Windows. How do I optimize?

I am forced to use Windows 10 for a project. Yes, I would rather use GNU/Linux. To keep my sanity, I've tried to regard Windows as a bootloader for Emacs :) Unfortunately, Magit (one of my favorite parts of Emacs, which also makes up for the lack of…
Hut8
  • 658
  • 6
  • 11
1
2 3
17 18