Questions tagged [magit]

is an Emacs extension for the Git version control system.

Magit is an Emacs menu interface to the Git version control system. Magit is implemented as an Emacs extension package -- a Git porcelain inside Emacs.

Unlike the Version Control package which is part of Emacs and strives to provide a unified interface to various version control systems, Magit only supports Git and can therefore better take advantage of its native features.

With Magit, you can inspect and modify your Git repositories with Emacs. You can review and commit the changes you have made to the tracked files, for example, and you can browse the history of past changes. There is support for cherry picking, reverting, merging, rebasing, and other common Git operations.

Magit is not a complete interface to Git; it just aims to make the most common Git operations convenient. Thus, Magit will likely not save you from learning Git itself.

711 questions
67
votes
2 answers

How to list branches with Magit

How do I list the branches of a repository in Magit (i.e., the equivalent of git branch --list)? I expected to find this in the branch popup, but it seems to be neither there nor was I able to find it anywhere in the "Inspecting" section of the…
Nikratio
  • 939
  • 1
  • 6
  • 11
63
votes
4 answers

How to easily cherry pick with magit?

I've been using magit for a few months now and I like it a lot. But one thing I still do it in a terminal is cherry picking. What is a simple way to do this?
caisah
  • 4,096
  • 1
  • 24
  • 43
52
votes
3 answers

Magit split hunk into two hunks

There's a question on SO about splitting hunks using magit, and the two solutions given are to either stage the region (mark a region, hit stage), or to shrink/grow all hunks using + & -. That's not what I'm after. In magit's status buffer, I want…
Squidly
  • 1,519
  • 14
  • 18
40
votes
3 answers

How to stash individual files with magit

git is capable of stashing of individual hunks. With --patch, you can interactively select hunks from the diff between HEAD and the working tree to be stashed. The stash entry is constructed such that its index state is the same as the index state…
ayvango
  • 585
  • 4
  • 6
37
votes
3 answers

How do I checkout a file from another commit in Magit

I've got a file foo.txt in branch A, and I want to check out foo.txt from branch B into the index. On the command line, I would do this: $ git checkout B -- foo.txt I want to be able to do this in magit by going to log, finding the commit I'm…
Emoses
  • 593
  • 5
  • 8
35
votes
2 answers

Reverse a hunk in Magit 2.1.0

I just upgraded to magit 2.1.0. (And also to emacs 25.0.50 and git 2.3.1.) Previously, in the *magit* buffer I could: Select a hunk in the Unstaged area. Type v and answer yes to reverse it. This was handy. But now in magit 2.1.0 it gives an…
Greg Hendershott
  • 1,493
  • 12
  • 17
33
votes
1 answer

how to move/rename a file within Magit?

The manual's introduction says: Magit wraps and in many cases improves upon at least the following Git porcelain commands: add, am, bisect, blame, branch, checkout, cherry, cherry-pick, clean, clone, commit, config, describe, diff, fetch,…
Jorge Israel Peña
  • 1,265
  • 9
  • 17
31
votes
1 answer

In Magit, what is the difference between a 'stash' and a 'snapshot'?

The Magit user manual includes two sets of "stashing" commands: lower-case commands save a stash, and upper-case commands save a snapshot. After consulting Google and Stack Overflow and the git-stash(1) man page, I still don't know what the…
Norman Ramsey
  • 1,175
  • 7
  • 13
27
votes
1 answer

Magit equivalent for "git remote -v" (list remotes)

I'm wondering if there is a magit equivalent to git remote -v to list remotes and their URL's defined on a git repository. The magit remotes popup offers options to add, remove, rename, and set url, but I don't see any sort of listing…
ebpa
  • 7,449
  • 29
  • 55
27
votes
2 answers

Magit log dates

In Magit log buffer commits (one per line) are shown with relative date. This is nice for recent commits, but makes little sense for older changes. In particular, this makes it annoyingly hard to relate commit dates to specific date, e.g. to find…
user8782
26
votes
2 answers

Magit - How can I checkout a remote branch locally without typing the entire branch name?

I have a remote branch remote-branch-long-name. When I magit checkout with helm completion I can type remote-branch and origin/remote-branch-long-name will show up as an option. The issue is that to checkout this branch locally, I actually cannot…
irregular
  • 1,012
  • 1
  • 10
  • 21
26
votes
4 answers

Magit - How to expand all and collapse all sections in magit-status

Pressing TAB on a single unstaged file shows or hides details pertaining to that file. How do I show & hide (toggle) details of all unstaged files at once? I did come across outline-hide-sublevels via M-x. But I would like to know a key combination…
orion
  • 825
  • 1
  • 9
  • 16
24
votes
2 answers

How to checkout ours/theirs on a file in magit?

Let's say I have a merge conflict. I see a conflicted file like this: Unstaged changes: Unmerged Foo/bar/wibble/plop/elbow.txt I can hit tab here to open the changes and maybe jump to a point inside the file to fix by hand, but if it's a big…
tenpn
  • 415
  • 3
  • 14
24
votes
3 answers

Using magit for the most basic add, commit, push

I normally use only a few git commands each time I want to commit changes to a repository: $ git add --all . $ git commit -m "update." $ git push -u origin master Can magit be useful in this regard? M-x magit-status seems helpful but I am not…
hatmatrix
  • 1,086
  • 2
  • 9
  • 18
22
votes
5 answers

Magit: How to show differences within lines

I have a file, I make some changes. Here how SmartGit shows differences. As you can see it shows where the difference is within the line. It changes background to red color in concrete position. And it's very good. I don't need to spend time to…
a_subscriber
  • 4,062
  • 1
  • 18
  • 56
1
2 3
22 23