Questions tagged [magit]

is an Emacs extension for the Git version control system.

Filter by
Sorted by
Tagged with
13 votes
2 answers
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 ...
user avatar
  • 24.3k
2 votes
1 answer
307 views

Magit version post-installation does not look as in the manual

I have just installed Magit from Melpa as per the instructions in the official Magit manual. I then proceeded to follow the manual's Post-Installation Tasks section, which states After installing ...
user avatar
  • 1,399
11 votes
1 answer
7k 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 ...
user avatar
  • 4,535
3 votes
1 answer
1k views

Magit show git hook output

I'd like to configure magit so that when I decide to commit my changes I'm shown not only the buffer to edit commit message and the diff of changes but also the magit-process buffer. Is there a way of ...
user avatar
56 votes
4 answers
14k 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, ...
user avatar
  • 22.4k
62 votes
2 answers
12k 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 ...
user avatar
  • 1,089
48 votes
3 answers
7k 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 ...
user avatar
  • 1,429
28 votes
3 answers
8k 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 ...
user avatar
18 votes
3 answers
6k 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 ...
user avatar
  • 648
9 votes
1 answer
681 views

How to well deal with the git diff with compatible to visual-line-mode?

I typeset my manuscript in org-mode with visual-line-mode turned on. Physically one of my paragraphs is just a line which is soft-wrapped. In this case, when I tried to git diff (magit) to see what I ...
user avatar
  • 2,290
28 votes
3 answers
7k 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 ...
user avatar
  • 493
17 votes
5 answers
2k 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?
user avatar
  • 273
8 votes
4 answers
6k views

How to install a specific version of package?

When I do M-x package-install RET magit it installs the latest version of magit which is 2.1.0. I want to install magit 1.4.2. I don't want to do it manually by downloading and loading package. ...
user avatar
10 votes
1 answer
1k views

Meaning of magit status buffer: Head, Merge, Push

Can someone explain what the top three lines of the magit status buffer mean? Especially Merge: origin/master Commit message Head: master Commit message Merge: origin/master Commit message ...
user avatar
  • 227
10 votes
7 answers
2k 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 ...
user avatar
  • 4,773
6 votes
2 answers
267 views

How to extend magit's context-sensitive push menu?

I'm using git to maintain a web site located on a remote server. My workflow has been as follows: Stage and commit changes to the web site (can do with Magit) ssh to the remote site and pull the ...
user avatar
11 votes
2 answers
1k views

Magit + gerrit - push to other branch

I am using gerrit. When I want to push my commits, I use following command: git push origin HEAD:refs/for/master How can I recreate the same command using Magit?
user avatar
  • 1,353
3 votes
2 answers
1k views

Jump to next merge conflict in project using Magit and Smerge

When I am resolving merge conflicts with Magit and Smerge, is there a way for me to cycle through all merge conflicts in the project? Currently I can only move through them one file at a time. I ...
user avatar
8 votes
3 answers
2k views

Magit asks for passphrase for ssh key every time

Running emacs 25.2.2 magit 2.12.1 on Kubuntu 18.04. I have set-up ssh keys for my bitbucket repository and I run ssh-agent on start. When I fetch or pull or push, magit asks for the passphrase for ...
user avatar
  • 1,668
2 votes
1 answer
802 views

Remove key binding in magit-status-mode

I have C-RET set to other-window globally. For modes that would override this I manually add a hook to the mode's key map, e.g. (add-hook 'magit-log-mode-hook (lambda () (local-unset-key (kbd "<C-...
user avatar
  • 121
0 votes
3 answers
485 views

New Magit interface: no actual "push"

I give this new interface the benefit of a doubt, but I'm close to just removing this version and going back to something earlier and more friendly. There appears to be no way, at least not on the ...
user avatar
  • 10.9k
0 votes
1 answer
1k views

Magit: How reset-soft to specific commit?

List of my branches: develop features/magi master Current branch is features/magi. I want to reset from current commit (commit 3) to previous commit (commit 1). So I use command: magit-reset-soft ...
user avatar
59 votes
4 answers
14k 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 ...
user avatar
19 votes
2 answers
7k 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 ...
user avatar
  • 847
33 votes
3 answers
11k 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?
user avatar
  • 797
25 votes
1 answer
2k 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, ...
user avatar
  • 6,824
15 votes
3 answers
759 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 ...
user avatar
  • 22.4k
11 votes
3 answers
799 views

A way to insert a predefined text into Magit's commit message window?

We have a convention that every commit message begins with an issue number. I'd like to be able to programmatically insert the issue number part (computed by a separate function) into the commit ...
user avatar
  • 467
24 votes
2 answers
2k 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 ...
user avatar
17 votes
2 answers
1k 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 ...
user avatar
  • 499
8 votes
1 answer
2k views

Magit and GitHub personal access tokens

What is the best way to use Magit with GitHub personal access tokens? Right now, pushing to GitHub causes Magit to prompt me for a username and password. I have to provide the access token instead of ...
user avatar
14 votes
2 answers
2k 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 ...
user avatar
  • 6,031
9 votes
2 answers
4k views

How can I compare two commit diffs in magit?

I want to directly compare the diffs of two commits in emacs (rather than seeing the diff of two trees at given commit points). A bonus would be being able to use ediff mode to compare the two ...
user avatar
  • 4,546
8 votes
1 answer
2k views

Use magit to compare all changes in two revisions

Is there a way to invoke Ediff from Magit in order to compare the changes to all files between two revisions, not just the changes in a single file? My use case is a coworker will ask me to review ...
user avatar
6 votes
3 answers
1k views

How do I toggle Magit enumerating untracked files?

git status in my configuration is extremely slow at enumerating untracked files, for reasons not relevant here. I'd like to have Magit use the -uno argument in most cases, in order to avoid a long ...
user avatar
4 votes
1 answer
346 views

Magit show status on selected directory

I have a git repo and I have changes in different directories. user@box:~/myrepo$ git st On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git ...
user avatar
  • 2,039
3 votes
1 answer
223 views

Insert and expand snippet when committing with Magit

I use a template with Git for keeping my commits messages neat and professional, as explained here. However, since I use Magit, I would like to insert and expand a snippet with Yasnippets because ...
user avatar
  • 2,574
2 votes
2 answers
329 views

How to make "canned commits" in magit?

At work we have several different commit messages that are used for every feature branch: branchname initial branchname ready for review branchname passed review branchname done plus a few more that ...
user avatar
  • 377
5 votes
2 answers
284 views

magit-status doesn't use the whole screen size in 2.3

In previous versions (before 2.3) M-x magit-status showed the status buffer taking the whole size of the current window. However, now it instead pops up a half-sized buffer (like e.g. C-h f does). ...
user avatar
5 votes
3 answers
1k views

Magit always use current branch to create new branch

I am currently on master branch and I have to create new branch called test starting from master. If I run b c in magit buffer, magit will prompt for starting point Create branch starting at (...
user avatar
4 votes
1 answer
293 views

How can I diagnose which `git` magit is running?

I'm trying to use Magit with TRAMP. The remote host has multiple git versions, necessitating (add-to-list 'tramp-remote-path "/usr/sup/bin") in my .emacs. However, when I run magit-status in a ...
user avatar
3 votes
1 answer
527 views

Mode-line not updated after checking out new branch using Magit

I create and checkout a new local branch via magit. Pressing M-x magit-status then b c for branch create and in the magit buffer I see the new name of the branch that I am apparently on. However ...
user avatar
  • 439
3 votes
1 answer
1k views

How can Magit add a credential to ssh-agent?

Can I make Magit add my ssh passphrase to ssh-agent instead ask me to use the passphrase a single time? Every time I push a commit to my remote I need to type my passphrase or instead run M-& ssh-...
user avatar
  • 219
2 votes
1 answer
102 views

What's this `slot-missing: Invalid slot name: "#<forge-database forge-database-156f3376b4d8>", :file`

I somehow messed up my magit/forge db, and now emacs won't forgive me. Now I can't open magit's status buffer, and sometimes not even a file buffer opens. This is all I can gather from the Messages ...
user avatar
  • 185
2 votes
1 answer
277 views

Why isn't magit-version available?

I have Git 2.5.3 installed and am using GNU Emacs 24.4.1 on Ubuntu. I just installed Magit from MELPA: (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (...
user avatar
  • 429
1 vote
2 answers
833 views

magit with tramp is not working with git correctly

I installed magit. I added the following lines to my .emacs: (require 'tramp) (push "/path/to/git/directory/" tramp-remote-path) And when I am in tramp I run M-x magit-version here is the output: ...
user avatar
  • 11
1 vote
1 answer
45 views

How is the history.el file written? Why did this change happen?

I have been tweaking my config file (init.el). This file is inside a .emacs.d directory which is under version control by Git. I also use Magit a lot. After editing my config, I was going to stage, ...
user avatar
11 votes
1 answer
893 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 ...
user avatar
7 votes
1 answer
299 views

Use `git add -N` in magit

Wondering if it's possible to indicate intent to add a file via magit. The intention would be to stage parts of an untracked file for a commit but leave the rest, rather than the default git add ...
user avatar
7 votes
2 answers
663 views

Can I have the git-log "--all" option be initially selected?

When I press the "l" key in the main Magit status mode, it pops up a window where I can adjust the options to be passed to the magit log command. Can I arrange for the --all option to always be ...
user avatar
  • 879