Questions tagged [magit]

is an Emacs extension for the Git version control system.

Filter by
Sorted by
Tagged with
5
votes
1answer
1k 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 ...
5
votes
1answer
1k 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. ...
5
votes
1answer
49 views

What is the equivalent of doing a plain `git reset <sha>` in magit?

I sometimes want to undo a commit without losing the changes, but just placing them back into an uncommitted and unstaged state. To do that at the cli, I do just git reset <sha-of-previous-commit&...
5
votes
1answer
1k 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 ...
5
votes
1answer
510 views

How can I paste my password when pushing?

Instead of memorizing all of my passwords, I use a password manager to store them for me. Currently, since I use Magit for most Git purposes, I need to go through several steps in order to push: P P ...
5
votes
1answer
252 views

Output to magit-process

When I run built-in magit commands, they output to the magit-process buffer. How can I do the same with a custom magit command that generates shell output?
5
votes
1answer
163 views

Show blame information for a line from the *magit* buffer

There's a workflow I tend to do fairly often and I wonder if Magit could help me. I've made a bunch of git commits on a branch, I haven't pushed them yet, and I notice a small mistake in my unpushed ...
5
votes
1answer
506 views

Magit commit mode does not open anything to edit with

I recently installed Magit and began running it. It appears to load just find and all keybindings seem to work perfectly. However, when I intend to commit changes, magit doesn't seem to open my ...
5
votes
1answer
210 views

How to hide the username in magit-log?

Trying to utilize a small screen, and I did this once before, so I know it's possible. How to hide the username in magit-log so that only the commit message is visible?
5
votes
3answers
1k views

How to change green background in magit running in xterm

I am running emacs in xterm with 'emacs -nw'. When examining diffs I find it hard to read text typed in yellow foreground and green background. How do I change it to eg. green/black or green/default ...
5
votes
1answer
2k 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
1answer
3k views

Configure Magit user name and email

Windows has an environment variable HOME which is on a remote serve (say Y:/, set by administrator and suppose not to be changed) and I start Emacs on my local disk, say C:/. (Emacs becomes slow if I ...
5
votes
1answer
111 views

Hide or fold stash section automatically in magit-status

I tend to stash a lot when using git, so my "stash" section in magit-stashes is getting pretty long. I'm not running out of hard-drive space or anything, so I don't want to delete the stashes. Can I ...
5
votes
1answer
590 views

magit tries to create new repository when I do magit-status in a repository

I recently updated magit from melpa. It seems that it requires Emacs 24.4. Since I had 24.3, I've also updated Emacs to 24.5. When I do M-x magit-status and choose the directory with .git, it asks me ...
5
votes
1answer
137 views

How can I prevent Magit-status command from grabbing the frame focus?

when executing magit-status and quickly focus out emacs, after the magit buffer pops up, emacs grabs the focus back. This is quite inconvenient. Is there a way to prevent that focus changing? The ...
5
votes
1answer
245 views

Notify about upstream git repo changes?

I have a repo for my dotfiles and update it here and there on various computers. Sometimes I forget to git pull before editting and git push. This creates conflicts or trigger git merge, or I just ...
4
votes
2answers
2k views

How to view each commit in magit easily?

When I press ll in Magit's status buffer, then it shows a log buffer listing commits. Then I want to show details about the commit at point in another window, but at the same time I want to stay in ...
4
votes
2answers
781 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 ...
4
votes
3answers
195 views

magit-status does not open, when using (global-whitespace-mode 1)

This problem started happening today when I switched to my desktop computer after a couple months of using my laptop. I updated emacs to 25.3.1, updated all my packages, and downloaded my latest ....
4
votes
2answers
2k views

Magit git diff between two specific SHAs

Using git cli I would execute git diff SHA#1 SHA#2 How does one do the equivalent in magit?
4
votes
1answer
2k views

Magit equivalent of 'git remote add origin git@github.com:user/project.git'?

For those who are trying to determine how to do this here is the answer. Yes the answer is in the docs! I missed it on the first pass. Then looked at questions such as the below, trying b u and ...
4
votes
3answers
786 views

use nonstandard `.git` directory with magit

I have been using the setup described on the top comment here to manage my dotfiles using git. In short, I have this in my .bashrc: alias config='/usr/bin/env git --git-dir=$HOME/.myconf/ --work-...
4
votes
1answer
1k views

Magit equivalent of `git branch -D -r origin/feature/someLabelHere`

On the command-line, I often do this git branch -D -r origin/feature/someLabelHere to remove a remote branch after a pull request from that branch has been merged into master. I know now to do git ...
4
votes
2answers
2k views

Magit how to cancel running git process

In Magit, how can I cancel a git process that is taking too long? If I did something like git push from a terminal, I could press control-C to cancel. How can I do this from Magit?
4
votes
1answer
3k 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 ...
4
votes
1answer
967 views

how to discard a change in magit from spacemacs

In a normal emacs (not spacemacs), discard change is bound to key of "k", then in spacemacs, base on the following information. http://spacemacs.org/doc/DOCUMENTATION.html On the other hand, ...
4
votes
1answer
991 views

Set default branch (or revision) to diff against, in magit

I frequently diff against the "master" branch, and would like it to be easier in magit. Right now, I can do one of these: y, then scroll to master, then hit d d RET. l l, then scroll to the commit, ...
4
votes
2answers
750 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-...
4
votes
1answer
1k views

How do I visit a file on a different branch?

I'm aware of C-x v ~ which allows you to see a different revision of the current file, but I would like to visit the file on another branch. Is this possible with magit, VC or git-timemachine?
4
votes
1answer
708 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.
4
votes
2answers
503 views

How to follow commit hashes in commit messages?

Some commit messages contain sha1 hashes of older commits in order to reference these commits, e.g.: Fixes: deadbeef Is it possible to visit the referenced commit from the first commit message?
4
votes
1answer
527 views

How to create a new branch from old commit using magit

When viewing the commit log, can I select a commit and checkout that commit as the head of a new branch?
4
votes
1answer
182 views

How to set magit recent commit always expand when i open magit status?

When I open a Magit status buffer, then the recent commit section is closed, I need to use TAB to expand it. How can I configure it to always be expanded.
4
votes
1answer
174 views

What happened to magit-remote-update in version 2.1

The previous version of Magit had a remote update command to replicate git remote update What is the replacement command?
4
votes
1answer
284 views

Displaying branch descriptions in magit

The release notes for magit 2.1.0 state "Branch descriptions can now be displayed in the refs or status buffer". However, I can't find these features documented in the info pages. I am using magit ...
4
votes
2answers
4k views

Use magit to display the difference between two branches

Is there a way to bring up a big list of the differences between specific commits across two branches? I tried the method described in this answer but it came back empty, I assume because the ...
4
votes
1answer
206 views

Magit unignore file

When in magit, I pressed i on a file and asked if I would like to ignore the file locally or globally. I chose locally. I assumed that it would write a line in my .gitignore file but unfortunately ...
4
votes
1answer
954 views

How can I tell magit to ignore specific modified files?

I am working on a project where webpack's bundle.js is part of the repository. This file is gigantic and has many diffs and slows magit down. Is there a way I can tell magit to ignore this file when ...
4
votes
1answer
99 views

Configure upstream for rebasing onto master in magit

I have a forked repository. I want to configure my upstream so that I can keep my master up to date and rebase my feature branches. How can I do this? magit-version returns Magit 20160810.653, Git 2....
4
votes
1answer
259 views

Version control information out of sync with certain modes

Sometimes, though seemingly not in a consistent way, some modes that use version control information do not get updated correctly after git commands are run (e.g.,diff-hl-mode or git-gutter-mode ...
4
votes
2answers
508 views

How to delete ^M in the diffs of Magit?

I had an issue with a file that had inconsistent line ending. My file would show a ^M for every line ending. I ran into this article that shows how to get rid of the ^M character and set the buffer ...
4
votes
2answers
600 views

Can I automatically see pre-commit hook output when committing with magit?

A coworker has just set up our main repo to use overcommit. It's lovely, and keeps us from invoking long CI builds which will fail for trivial reasons by warning us about issues using pre-commit hooks....
4
votes
1answer
139 views

Can I move lines when committing parts of a hunk in magit?

I prefer to have small and focused commits but don't always code that way. I've got a code section to the effect of if abc: def etc I edited def and etc, and the hunk in magit shows both as ...
4
votes
1answer
309 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 ...
4
votes
1answer
190 views

Magit appends '^M' (return) characters to git results

In the magit-status window Magit shows '^M" for many things. This is on FreeBSD, which should be using newlines instead: This is, I think, the reason the push doesn't work right. From the magit-...
4
votes
1answer
1k views

How to checkout a specific commit inside magit?

Inside the magic log history, I could see lots of commits, and I want to rollback to the specific commit, how to do that? I could move to that commit, use "d" could see the different/change of that ...
4
votes
2answers
2k views

Magit - How to drop all stashes at once?

I have created quite a few stashes and I wanted to drop all of them at once. From terminal I could have done git stash clear I couldn't find a way to do it from magit. I tried selecting all ...
4
votes
2answers
787 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:
4
votes
1answer
73 views

Magit: Howto create a new commit ignoring white-space differences

I'm using magit 20191128.39 on Emacs 26.3 When changing a python script resulting in a new unstaged change, git/magit should ignore whitespace-differences. A git diff -w will do the trick, but I'd ...
4
votes
1answer
146 views

Can magit pull hunks from another commit into my branch?

I have a big commit on another git branch. I'd like to "cherry-pick" some hunks from that commit into my current branch. I bet magit can do that, but I'm not sure how. Anyone? (I've seen ways to ...

1 2
3
4 5
12