Questions tagged [magit]

Magit is an Emacs mode for interacting with Git.

Magit is an interface to the version control system Git, implemented as an Emacs extension.

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's maintainer prefers if questions are asked on the dedicated Emacs Stackexchange site instead of here.

159 questions
96
votes
5 answers

View a file's history in Magit?

View the change history of a file using Git versioning talks about other ways of viewing history of a file in Git. Can it be done in Emacs Magit?
eugene
  • 33,301
  • 47
  • 188
  • 382
82
votes
3 answers

Splitting a hunk with magit

I have 2 edits very close by (and therefore part of the same hunk), that I'd like to commit separately. Is it possible to split a hunk from within magit?
deepakg
  • 1,640
  • 1
  • 12
  • 10
78
votes
2 answers

Magit revert single file

The question is about Magit major mode for Emacs function and less so about how to do this via command line interface. I only have a local Git repository. How would I restore a selected file to its previous version? I believe that the Git command…
user797257
60
votes
2 answers

git blame with commit details in emacs

From emacs, how can I see the details (e.g. commit message) of the commit that last changed the line at point? I have magit installed.
Robin Green
  • 29,408
  • 13
  • 94
  • 178
54
votes
3 answers

How can I diff a single file with magit?

Say I've made a number of unrelated changes to uncoupled files in my git repo. I want to review and commit each of the files separately. I run magit-status, and get a list of changed files. But the only magit diff commands I can find (d and D) diff…
Dan
  • 10,845
  • 11
  • 46
  • 75
29
votes
8 answers

How to open magit-status in full window

I am using Magit to work with git in emacs. I have bound magit-status to a key, but every time I hit the key it opens in a split in lower half of the window and i have to hit C-x 1 to get it into a full window. How can I make it open in a full…
Mad Wombat
  • 12,616
  • 9
  • 58
  • 93
28
votes
4 answers

Using emacs (and magit?) to visit a file in given commit/branch/etc

If I want to see how foo.bar looked like in some certain commit then I can invoke: git show :foo.bar Nice... How can I do it in emacs? Using magit? Using vc? Say I am visiting the file foo.bar and I want to look up how it…
Dror
  • 9,918
  • 17
  • 70
  • 137
26
votes
3 answers

How to use git mv from magit?

Is there a nice way to call git mv on a file from within magit? I know it's possible to run any git command with :, but this won't autocomplete filenames.
Yossarian
  • 4,687
  • 1
  • 32
  • 54
22
votes
2 answers

How to revert a change from older commit in `magit`?

I know how to get to a diff from an older commit: get to *magit-log*, and "click" on the commit. How to get a particular change in the diff applied in reverse? I want it to just modify the file (and buffer, if open).
lukstafi
  • 1,825
  • 14
  • 22
18
votes
2 answers

Most developed magit/github extension for emacs for pull requests

I'm specifically interested in pull requests, editing issues and tying them to commits, and other things I generally have to use hub on the command line for. However, I've started using magit and really like the keybindings and general…
Mittenchops
  • 15,641
  • 28
  • 103
  • 200
17
votes
3 answers

Compare foo.bar from two different branches in MAGIT

This answer shows how to see the differences between a specific file foo.bar in two different branches in git. My question is how to do this within magit?
Dror
  • 9,918
  • 17
  • 70
  • 137
13
votes
2 answers

Emacs Magit commit opens new Emacs client

I've been using Magit for awhile, and when committing, it used to simply split the window and allow me to commit from within the same emacs session, but I seem to have changed this behavior to the following: Now, when I commit my staged changes, a…
FellyTone84
  • 525
  • 7
  • 15
13
votes
4 answers

magit: how to diff the same file between two different commits on the same branch?

How can I get the diff between two commits of the same file using magit? Directly form git one can do this. But I don't know how to do it from within magit. From magit-status it seems that d and D returns the diff of the whole repository. This is…
Dror
  • 9,918
  • 17
  • 70
  • 137
12
votes
5 answers

emacs magit diff highlighting

I'm just getting started with magit. I really like it, except that the diff viewer is really annoying to me. The chunk highlighting makes no sense because as I scroll around the cursor moves with the screen, highlighting new regions. There is also…
Chris H
  • 5,909
  • 4
  • 31
  • 48
12
votes
2 answers

How to delete a remote branch using magit in emacs

what is the magit key sequence which is the equivalent of git push origin :branch-to-be-deleted that will cause the branch to be dropped from the remote repo.
Arthur Ulfeldt
  • 87,736
  • 24
  • 197
  • 278
1
2 3
10 11