We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [magit]

is an Emacs extension for the Git version control system.

Filter by
Sorted by
Tagged with
53
votes
1answer
5k views

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?
47
votes
4answers
10k views

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, ...
43
votes
2answers
8k views

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 ...
43
votes
4answers
9k views

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 ...
43
votes
2answers
6k views

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 ...
40
votes
3answers
7k views

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?
37
votes
3answers
11k views

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

What is the Magit equivalent of git add [--intent-to-add] <filename> for checking a newly created file into Git?
32
votes
3answers
3k views

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 ...
28
votes
2answers
9k views

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?
26
votes
2answers
5k views

Git rm from magit

This is a very basic but I have been unable to find the answer on the web. Is it possible to git rm, i.e. to remove a tracked file, from magit? Thanks
25
votes
1answer
3k views

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 ...
24
votes
2answers
5k views

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 ...
23
votes
3answers
9k views

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?
20
votes
1answer
2k views

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 ...
20
votes
1answer
1k views

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, ...
19
votes
2answers
3k views

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 ...
19
votes
3answers
5k views

Magit, how to use system's ssh agent and don't ask for password

I've googled and read the FAQ and Wiki for Magit, but still unable to figure this out, all I find are answers about Windows... How can I configure Magit to use my running ssh-agent session and don't ...
18
votes
2answers
824 views

How to pronounce “magit”?

Q: How does one pronounce magit? It occurred to me today that I've never said "magit" out loud, and I'd prefer not to make a fool of myself if I ever have to do so. So: is the g in magit pronounced ...
17
votes
1answer
1k views

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(...
17
votes
1answer
3k views

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, ...
17
votes
1answer
1k views

How to access command switches in Magit

Most magit commands are invoked with a single key, which pops up a menu of subcommands and switches. For example, P shows P and t as subcommands and -f and -u as "switches." Hitting the letters for ...
16
votes
2answers
3k views

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 ...
16
votes
2answers
2k views

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 ...
16
votes
1answer
448 views

Combining magit with undo-tree for easy history navigation

I love undo-tree (screenshot below). It provides an easy way for navigating through different versions of a file (top window) by letting the user move around the file's history tree in a separate ...
15
votes
2answers
1k views

Can Magit do git format-patch?

I just wanted to know if Magit has this functionality. The reference manual does not have this explicitly so that's why I am asking.
15
votes
5answers
1k views

How can I make `--verbose` flag be enabled by default in magit commit screen?

Right now, instead of pressing just cc in magit-mode, I have to press c-vc every time to enable --verbose. Is it possible to make it enabled by default?
15
votes
2answers
1k views

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 ...
15
votes
3answers
555 views

Command to visit Github pull request of current branch with Magit

It's very common that, after pushing a given branch upstream, I'll want to visit it on github and create a pull request. I'm starting to get annoyed at having to manually visit the repo, find the ...
14
votes
2answers
1k views

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-...
14
votes
2answers
967 views

Manage several git repositories from magit

I'm maintaining several git repositories using magit, and their numbers keep growing. Is there a way to inform magit of all these projects so that a single command would present a summary of the ...
14
votes
2answers
4k views

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 ...
14
votes
2answers
1k views

Git: is it possible to stage a selected region directly from the file buffer?

With Magit you can open the magit status buffer, press TAB to expand the diff (or RET to bring up a separate diff buffer), mark parts of a hunk and press s or u to stage/unstage the region. Really ...
14
votes
2answers
379 views

Magit pushing / pulling show progress

I'm missing some visual indication of the push / pull progress. After executing the appropriate command, magit prints Pushing to domain.tld:repo.git however, no further indication of the ...
13
votes
2answers
3k views

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 ...
13
votes
2answers
6k views

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? ...
13
votes
1answer
1k views

magit blame: is there an equivalent for “show me the file before this commit” from VC?

VC blame mode has a nifty a hotkey "show me blame of the file before the commit I'm pointing at". Is there an equivalent in magit?
13
votes
4answers
497 views

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 ...
12
votes
2answers
2k views

How do I force a specific buffer to open in a new window?

When committing changes in Magit, it is useful to have the diff view open while adding details about the commit. In Magit, we see the diff in the *magit ..* buffer. When you hit cc while the cursor ...
12
votes
2answers
1k views

Is it possible to limit magit's log view to just commits from the current branch?

Currently when I bring up the local magit log ("l l") it takes a fair amount of time. It would be nice for the log just to limit itself to the nearest merge base (e.g. vs origin/master) but I haven't ...
11
votes
2answers
5k views

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 ...
11
votes
1answer
2k views

Simple rebase from master with magit?

I just upgraded to the newest version of Magit having used the old version for years. All the improvements are great after a little searching around and figuring out the differences. Now, I'm just ...
11
votes
1answer
4k views

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 ...
11
votes
1answer
5k views

How do I set the upstream branch to push a local branch to in magit?

From what I remember, if I am working on a branch, e.g., my-feature-branch, I used to be able to do this from the magit-status menu with P P, and then selecting the remote branch from a list which had ...
10
votes
8answers
1k views

magit-push hangs on Windows

I'm using GNU Emacs on Windows, and I am unable to use magit-push to push my local changes to a remote repository. This happens with remote repositories regardless of if they are accessed with SSH or ...
10
votes
1answer
4k views

Magit diff side by side

I would like to know if there is a way to get the standard side by side diff view in magit. That is, instead of seeing the old code chunk and the new one one after the other, I'd like to see them on ...
10
votes
7answers
1k views

How to Implement Popup Menu Similar to That Used in Magit

Question I would like to create user interface in form of popup menu, popup menu similar to that used in Magit. Features Definition of Popup Popup in context of this question means little ...
10
votes
1answer
509 views

Magit custom commands

Magit displays the progression of multi-step commands with popup windows. For example, pressing c brings up the commit menu, whence pressing a will invoke magit-commit-amend. I would like to include ...
10
votes
2answers
484 views

Magit: don't ask to save changes

When I have a buffer with unsaved changes, magit asks for each and every action to save that changes. I didn't save that changes on purpose, so is there a way to disable this behaviour? My Magit ...
10
votes
3answers
1k views

How to prevent Magit from asking where to push a branch?

When calling magit-push-current with P P from the status buffer, Magit 2.1.0 asks me where to push the branch on the first time, when upstream is not set. How can it let automatically generate the ...
9
votes
2answers
770 views

Default Magit commit state in Evil

I use evil. Normally, when I commit, I'd like to immediately start typing, but evil starts the buffer in evil-normal-state. I used to set (evil-set-initial-state #'git-commit-mode 'insert) But that ...