Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [magit]

is an Emacs extension for the Git version control system.

3
votes
1answer
452 views

Vim/Evil keybindings in Magit 2.1

I love vim keybindings. For older versions of Magit, I used this to allow j/k scrolling: (define-key magit-status-mode-map (kbd "k") #'previous-line) (define-key magit-status-mode-map (kbd "K") #'...
4
votes
1answer
808 views

Show git log for the current file in Magit 2.1

In 1.x Magit used to provide magit-file-log to list the Git log for the current file. Unfortunately, this command seems to be gone from Magit 2.1? How do I list the Git log for the current file now ...
6
votes
3answers
319 views

Viewing Github PRs in Magit 2.1.0

In the previous version of Magit, I learned from oremacs that you can view and checkout Github pull-requests in Magit by adding the following line to a remote's definition in .git/config. fetch = +...
2
votes
1answer
188 views

How to log file following all renames?

I upgraded to recently released Magit 2. There is a command magit-log-buffer-file. However, it logs file without --follow option, which makes it quite pointless for me (in our source code nearly ...
2
votes
1answer
86 views

Font-lock for strings messes up non-code buffers

In Magit buffers, or helm-swoop, an unclosed double quote enables the string highlighting for the rest of the buffer (until another quote is found). This is how it looks like: Because of that, I also ...
1
vote
1answer
418 views

Automatically quit emacs after git-commit-commit in git-commit mode

I am using emacs -nw as in-place commit message editor for my git. When pressing C-c C-c in git-commit mode, I want emacs to quit automatically. Currently, .git/COMMIT_EDITMSG is saved, and the buffer ...
2
votes
1answer
116 views

Should magit revert a buffer after I discard a change from it when magit-auto-revert-mode is t?

With magit 1.4.1, I have magit-auto-revert-mode set to t. When I visit a file in a buffer, make a change and save, then call magit-status and run magit-discard-item on the modified file, then switch ...
3
votes
1answer
338 views

Why does magit give so many “reverting buffer” messages?

I am still very much a beginner when it comes to version control, and am using magit. It seems like committing changes (frequently but not always?) triggers "reverting buffer" messages, one for ...
7
votes
1answer
400 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 ...
25
votes
2answers
8k 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?
2
votes
1answer
69 views

Where is this `make-magit-section` function defined?

I'm looking at the magit source code, and there's this make-magit-section function that doesn't seem to found anywhere in the project (grep doesn't return any results). describe-function says that ...
2
votes
1answer
216 views

“C:/c/user/…my-folder/ isn't an existing directory” error

I use Emacs 24.5.1 with Spacemacs and added Msys2 to the exec-path to use git.exe When I run 'Magit-status' I get the following error: C:/c/user/...my-folder/ isn't an existing directory. I can see ...
4
votes
1answer
896 views

Stage diff hunk into git from ediff?

How do you stage a hunk into git from ediff? I'd like to be able to view a side-by-side diff and stage hunks into the "HEAD" side of the diff, but that buffer (i.e., spacemacs.~master~) is read-only. ...
2
votes
2answers
880 views

customize-face magit-item-highlight properly

I have a problem with the magit-item-highlight in different themes. With monokai, zenburn, etc., the item highlight is a background, and does not interfere with green and red diff faces. However, with ...
10
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 ...
33
votes
3answers
6k 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?
2
votes
1answer
894 views

How do I clean up my local commits and rebase to upstream master in magit?

I have forked the interleave package. I made certain commits in my fork but now I want to discard them. I added the remote upstream branch (master branch by the interleave author), fetched it and ...
2
votes
2answers
675 views

How do I prevent magit from asking to set upstream while pushing?

When I want to push to a different upstream than origin, I use P C-u C-u P so I can set the upstream of the command, however magit always prompts me with question to set upstream also. How do I ...
-1
votes
1answer
349 views

Magit fails to create local repository

This is what I got when I select a directory (whether it had a git repository) and choose "yes" when magit asks if I want to create one: Debugger entered--Lisp error: (wrong-type-argument stringp nil)...
0
votes
1answer
714 views

magit fails to install

I am unable to install magit with package.el. While other packages install correctly, magit (v 90150116) currently gives me: Debugger entered--Lisp error: (wrong-number-of-arguments #[(ad--addoit-...
1
vote
1answer
85 views

What is happening when my uncommitted changes temporarily disappear from magit?

More then once when I have been reviewing changes to be committed in magit, the pending changes have unexpectedly disappeared from the status buffer. I'm pretty sure it's because I am accidentally ...
46
votes
1answer
4k 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?
7
votes
3answers
2k views

Get git repo root directory, preferably with magit

How can I get the root directory of the current git repo? I could run shell-command-to-string on something like git rev-parse --show-toplevel. Is there a better way? Does magit or any other git front-...
22
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?
7
votes
2answers
755 views

Default commit comment for magit

Is there a simple way to have default text pre-populate in the comment buffer when commiting code with magit?
37
votes
2answers
6k 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 ...
16
votes
2answers
2k 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 ...
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
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 ...
25
votes
3answers
2k 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 ...
13
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 ...
41
votes
4answers
9k 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, ...
1
vote
1answer
731 views

How to set magit remember git passphrase on Windows?

I run magit on Linux and it works very well. On Windows, it works almost the same except the push process: Git Bash would ask me to enter passphrase to continue, while magit just hangs. I set ssh-...
4
votes
2answers
628 views

Which version of magit am I installing?

Here is a snapshot of my list-package result related to magit: Question: There's nothing in my init.el on marmalade, why the package from marmalade are also listed? If I run M-xpackage-...
15
votes
3answers
512 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 ...
15
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 ...
13
votes
4answers
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?
4
votes
2answers
575 views

How to make vc-* and magit treat a symbolic link to a real file in git repo just like the original file?

Say, I got ~/.emacs which is a soft link to ~/.emacs.d/init.el(using ln -s ~/.emacs.d/init.el ~/.emacs) which is in a git repo, because this will make it easier to reach init.el, outside or inside ...
8
votes
3answers
274 views

How to scroll up when expanding a section in magit-status?

In the magit-status buffer, pressing TAB shows or hides a given section, which is handy when looking at unstaged content and see what hunks can be staged. However, when tabbing on a section, the ...
7
votes
2answers
501 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 ...
7
votes
1answer
749 views

How to make `truncate-lines` nil and `auto-fill-mode` off in magit buffers

I got (setq-default fill-column 80) (setq-default truncate-lines nil) ;; which is default When using magit in Emacs, I know that I should avoid long commit messages, but sometimes they just cannot ...
4
votes
2answers
581 views

How to get colors in Magit diffs on Windows?

Color codes are not working on my Windows 7 box. I have working colors in Git Bash that comes with the Git install. Here is what I get:
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 ...
3
votes
5answers
445 views

How to get a major mode to open full screen

I'd like magit to default to a large buffer instead of one that is half the size of the available space. Even better would be a way to wrap the call to a major mode to make this happen when opening ...
5
votes
2answers
382 views

What is the best way to reload git stashed changes you've popped while file is open in buffer?

When I'm viewing a file and then pop a stash which modifies that file in the working tree using git stash pop in either bash or eshell, what is the best way to immediately see those changes in the ...
13
votes
2answers
324 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 ...
5
votes
1answer
1k 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 ...
10
votes
8answers
957 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 ...
4
votes
1answer
2k views

Magit on Windows: “searching for program: permission denied, git”

I installed Magit on Windows, but every time I use it, it give me the error: searching for program: permission denied, git even though I already installed the git software on windows. (it seems ...