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.

2
votes
1answer
43 views

Latest Magit expands hunks after staging

With the latest version of Magit (20180410.432) I feel that the staging behavior has somewhat changed. Before, I used to expand the unstaged files in the Status Buffer, then stage the hunks one by one....
0
votes
2answers
80 views

Stage changes in just the first line of hunk

Consider the following situation: $ printf $'line1-v1\nline2-v1\n' > test.txt $ git init . $ git add test.txt $ git commit -m 'Initial commit' $ printf $'line1-v2\nline2-v2\n' > test.txt Now, ...
0
votes
2answers
80 views

How can I get a prompt for deleting index.lock file in magit?

This is a long standing issue https://github.com/magit/magit/issues/2708 . I feel that a prompt for deleting the transient file would compensate in most cases. Is there a reliable way to achieve this? ...
1
vote
1answer
700 views

Magit - How do I sync my feature branch with the latest master without checking out master?

Here's what I am trying to do:: I have one project in one git repository. I've made some changes in master and created a spinoff branch (b s) called my-feature. Now I've finished my feature and would ...
3
votes
1answer
99 views

git rebase -x (“exec”) with Magit?

Is it possible to use the "exec" mechanism when rebasing with magit? From the git rebase man page: -x <cmd>, --exec <cmd> Append "exec <cmd>" after each line creating a ...
1
vote
1answer
57 views

How can I determine if a `git` branch is a remote-tracking branch using Magit?

Is there a function magit-magic such that (magit-magic "master") => t (magit-magic "origin/master") => nil assuming origin/master is a fetched, but possibly unpulled branch on remote origin? (...
2
votes
1answer
448 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 ...
1
vote
1answer
68 views

magit function to check if a branch is in sync with remote

Is there a function in magit to check if a branch is in sync with with it's remote (basically I want to check if both branches sit on the same commit) At the moment I check if remote branch and the ...
2
votes
1answer
284 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-...
2
votes
1answer
355 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 ...
4
votes
1answer
83 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 ...
2
votes
1answer
261 views

Magit: amend the last commit with sign off

What if I forget to sign-off my last commit, how can I fix the last commit within Magit? I can do that with git command: $ git commit --signoff --amend Of cause I can write the sign-off by hand in ...
1
vote
1answer
797 views

Error (use-package): Failed to install magit: Package `magit-' is unavailable

I am starting to build up a .emacs file to be used as a development environment within Docker containers. I get this error when starting emacs-nox in a Docker container. Error (use-package): Failed ...
3
votes
1answer
297 views

Magit: magit-merge-squash

When I was researching the best way to merge a feature branch with a lot of WIP commits I came across squashing and rebasing however when looking how to do this in magit I found this sentence in the ...
0
votes
1answer
66 views

Revert buffer messages in echo area obscure minibuffer

My issue is that when I switch git branches in a project, each file that changes needs its buffer to revert, and this message is spat to the echo area for each file. If I try to run a command from the ...
1
vote
1answer
41 views

magit-define-popup-switch not enabled by default

I'm trying to teach magit that git pull --rebase should always --autostash. pull --rebase is always my default, so I want --autostash to be the default as well. The 5th argument of magit-define-...
0
votes
1answer
32 views

How to execute a function on the name before creating a branch in magit?

I want to execute the following function on the provided name before creating a new branch in magit: (defun pb/magit-new-branch-name (branch-name) "create a name usable as a branch name from branch-...
4
votes
3answers
365 views

Why does magit now prompt for which submodule to update?

I used to be able to press "o" then "u" (magit-submodule-update) in a magit buffer and have it update all my submodules. Now, it asks me to type in the path of which submodule I want to update. Is ...
1
vote
1answer
87 views

Magit stage modified without confirmation

(magit-stage-modified 'all) stages all modified files, but only after confirming it with the user with the message Stage all changes? (y or n). The function is defined as follows: (defun magit-stage-...
7
votes
1answer
345 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 ...
5
votes
1answer
83 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 ...
3
votes
3answers
144 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 ....
0
votes
1answer
195 views

magit-status does not highlight diffs

I'm currently seeing a display problem in Magit. For a while I've seen that when I do magit-status, the diffs are no longer highlighted. I didn't care for a while, thinking it was the theme I've been ...
1
vote
2answers
234 views

How to make magit use --force-with-lease as default when pushing?

As per Magit's visual walkthrough, it is possible to save some configs as defaults, e.g: for diffing (section "Changing diff arguments"). I went through the documentation, but did not find anything ...
0
votes
1answer
158 views

Magit magit-diff-refine-hunk does not work if I don't move the cursor to the good lines

In magit, it looks like that if I want to have a diff that highlight changing words, I can either press D t when I'm in the diff, or put in my .emacs (custom-set-variables '(magit-diff-refine-hunk ...
1
vote
1answer
140 views

Magit: stash push

The stash "push" command is really practical, while stash "save" is supposed to be deprecated. However, on magit I can just find stash save... Is there any reason for that? Did I miss something? ...
2
votes
2answers
83 views

Could magit be writing `.git/index` without my intervention?

I'm trying to track down an issue which might be caused by magit. I work on multiple machines, and on each machine I have an emacs running, each of which has some magit buffers open. I keep machines ...
0
votes
1answer
80 views

changes in commits are not shown any more

when commiting in magit it used to open a diff window where I could see the changes I'm commiting right now. For some reason this window doesn't open any more on some repos. I must have disabled this ...
0
votes
1answer
64 views

Magit status wired output (control sequences)

When I use magit on a RHEL 7 box today, it gives me this output when checking magit-status: Not sure what went wrong. Magit-version output is: Magit 2.11.0, Git 2.14.1, Emacs 25.3.1, gnu/linux The ...
0
votes
1answer
139 views

Magit pushing through tramp does not work

Hi guys I'm on a osx machine and I want to push commits from a remote machine through tramp to github. I open the directory in dired on the remote machine which works fine and type M-x magit status ...
2
votes
1answer
78 views

make magit check uncommited changes when opening a file

Sometimes I am interrupted while coding and forget to commit. I would like to be warned about this next time I open a file with uncommited changes. I tried (defun my/magit-check-file-and-popup (file)...
0
votes
1answer
188 views

How to move master to branch in magit?

This is how I move master to branchX in git: $ git checkout master #move HEAD to master $ git branch -f branchX HEAD #move by force, HEAD to branchX Is there a way to do that in Magit?...
0
votes
1answer
137 views

How to view remote URLs on magit?

I would like to make sure I know where I am fetching, pulling, and pushing to. How to view remote URLs in magit? From the magit manual "7.1.1 The Remote Popup" on https://magit.vc/manual/magit/The-...
0
votes
2answers
770 views

How to setup upstream remote using Magit?

I am reading through the magit manual trying to figure out how to configure remote variables. From the magit manual "7.1.1 The Remote Popup" on https://magit.vc/manual/magit/The-Remote-Popup.html : ...
5
votes
2answers
297 views

Merge specific files with magit

Is there a way to merge single files in magit like you would do from this question or something equivalent. Namely: $ git checkout source_branch -- <paths>...
2
votes
1answer
202 views

Always show expanded Magit sections by default

Sometimes the sections such as "Recent commits", will be closed by default. Can I set it so they are all always open by default? But before I made the commit, recent commits was opened. After the ...
3
votes
1answer
213 views

magit: display the commit log around the commit I'm interested in

How can I jump to the commit log around the commit I'm interested in? I use magit-blame a lot while reading the history of a project. While doing that, I RET to see the commit that changed the line ...
2
votes
2answers
1k views

How can I do a git diff on the current file?

I'd like to do a diff on the current file / buffer compared to the git repository. Ideally a single function that could be called, or binded to a keyboard shortcut.
6
votes
1answer
165 views

Use `git add -N` in magit

Wondering if it's possible to indicate intent to add a file via magit. The intension would be to stage parts of an untracked file for a commit but leave the rest rather than the default git add ...
1
vote
1answer
122 views

Magit diff with --name-only?

I am browsing the differences between two branches of a repository via git diff --name-only branch1 branch2 I also use the --name-status option sometimes, since I may need to see what sort of ...
2
votes
1answer
59 views

Magit hunk with long lines set default hidden

When I am using magit and open a a certain commit containing hunks with very long lines (a minified javascript file, css ...), emacs does not respond anymore or it becomes very slowly, luckily still ...
0
votes
1answer
213 views

Overriding a magit Keybinding using evil-mode and bind-map

I am using evil-mode, magit, evil-magit, and bind-map. I have defined a map with bind-map using SPC as my :evil-keys similarly to what spacemacs provides. Magit defines SPC as magit-diff-show-or-...
1
vote
2answers
228 views

Magit: Can't do any command on Emacs

Windows 10, Emacs 25.1, Magit. I get this kind of message: And I can't do any command on Emacs. Always show this message. Or for those who have difficulties reading such tiny text: Error in post-...
0
votes
2answers
598 views

magit: GitError! Could not read from remote repository. [Type `$' for details]

For some repositories at work I get the following message when I try to push my commits: GitError! Could not read from remote repository. [Type `$' for details] The details read: 128 C:/Program ...
2
votes
2answers
110 views

corrupted magit

Last week I had to abort a rebase in magit. Soon after my computer became unstable so I rebooted. Today, when I do C-x g for magit-status, I get an error in the status line Setting current ...
1
vote
2answers
79 views

magit: The work for five tasks are mixed in my working directory

So during a hectic coding session, I forgot to do git commit as I did baby steps. Now I have fifty changes in my working directory. And these changes are related to five separate tasks. So I would ...
0
votes
1answer
154 views

How do I apply a patch from gnus to a git repo?

I've got an email with a dozen .patch files attached in gnus. I can save them to e.g. ~/Downloads and then apply them with magit-patch-apply-popup, but considering that I've got gnus open on the left (...
0
votes
1answer
112 views

What are the requirements to stage a hunk from any Magit diff buffer?

I cannot stage a hunk with magit-stage in any *magit-diff buffer except the *magit-diff buffer created via status buffer. Magit says "user-error: Cannot stage committed changes". I mean, I cannot ...
0
votes
1answer
104 views

Is there a Magit hook for post checkout?

Unfortunately, the vc-mode in my mode-line is not being updated when checking out a branch, it still points to the older branch. revert all open buffers fixes than but I can't find a hook to attach ...
0
votes
2answers
157 views

Magit reuse same window for different project when switching window

I'm a new user of magit and I'm currently using it in a separate frame with a single window (magit-status). I'd like that to show the git status of the project of the latest visited buffer. Imagine ...