Questions tagged [magit]
is an Emacs extension for the Git version control system.
83
questions
13
votes
2
answers
3k
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 ...
2
votes
1
answer
353
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 ...
11
votes
1
answer
8k
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 ...
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 ...
69
votes
2
answers
13k
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 ...
57
votes
5
answers
16k
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, ...
35
votes
3
answers
9k
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 ...
31
votes
3
answers
10k
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
3
answers
7k
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 ...
18
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?
12
votes
2
answers
2k
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?
11
votes
1
answer
1k
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
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 ...
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
...
9
votes
4
answers
7k
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.
...
9
votes
1
answer
733
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 ...
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 ...
6
votes
2
answers
318
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 ...
4
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 ...
4
votes
1
answer
365
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 ...
3
votes
2
answers
408
views
What's this `slot-missing: Invalid slot name: "#<transient-prefix transient-prefix>", :incompatible`
After updating to magit 20190517.1750 from ELPA, I've got this warning
slot-missing: Invalid slot name: "#<transient-prefix transient-prefix>", :incompatible
which breaks a lot of magit ...
2
votes
1
answer
960
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-...
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
...
0
votes
3
answers
522
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 ...
67
votes
4
answers
17k
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 ...
51
votes
3
answers
9k
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 ...
33
votes
3
answers
12k
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?
27
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, ...
27
votes
2
answers
3k
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 ...
22
votes
2
answers
9k
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 ...
21
votes
5
answers
3k
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 ...
18
votes
3
answers
2k
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 ...
16
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 ...
15
votes
3
answers
838
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 ...
11
votes
3
answers
1k
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 ...
9
votes
2
answers
5k
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 ...
9
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 ...
8
votes
1
answer
3k
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 ...
8
votes
1
answer
399
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 ...
7
votes
1
answer
1k
views
Is there a way for magit to display the branch in the dired buffer mode line for a given directory?
I'm moving to emacs from shell/Vim and I'm very used to seeing the branch I'm working in when I'm at the project level. Is there any way to get the Git branch name to display in the dired buffer mode ...
7
votes
2
answers
723
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 ...
6
votes
3
answers
2k
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 ...
6
votes
1
answer
1k
views
Magit: Auto-refresh "magit-status"
Windows 10, Emacs 25.1, Magit
I want auto refresh buffer "magit-status" when was some change on files in my project.
So I set variable magit-refresh-status-buffer to on non nil. But it not help.
6
votes
1
answer
1k
views
Magit commit is slow even for tiny changes
For the last few months, committing even tiny changes using magit (c c) is really slow to bring up the commit message buffer. I've profiled the code that is executing during that time but I'm not ...
6
votes
3
answers
2k
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 (...
5
votes
2
answers
2k
views
magit with tramp is slow
Here is my environment:
project A is on the server. My PC connects to the server by 1 Gbit ethernet. Ping latency between PC and server are about 0.3 ms.
project A's source code size is about 75 MB. ...
5
votes
1
answer
3k
views
magit: how to set default username?
Is it possible to set a default username (i.e.: my Github user name) for magit? It is prompting for the user every time I have to push a commit.
Don't know if this may help with the answer, but I ...
5
votes
2
answers
335
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). ...
4
votes
1
answer
427
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 ...
3
votes
2
answers
366
views
Pushing with P P does not work for me
Reading the Magit user manual, there is an entry on pushing the current branch to its upstream branch, by pressing P P. This is not working for me, as I get P isn't bound to any action on the second P ...