Questions tagged [magit]
is an Emacs extension for the Git version control system.
664
questions
1
vote
2
answers
80
views
How can I configure magit to use `diff-so-fancy`, not `magit-delta`?
How can I use diff-so-fancy in magit rather than magit-delta?
I'd like to refine diff buffer in Emacs with magit.
I found diff-so-fancy and prefer it to delta for several reasons.
I installed diff-so-...
2
votes
0
answers
20
views
How to force a git checkout revision in Magit if there are unstaged changes?
On the terminal, in a repository with unstaged changes, I can do:
~/projects/introduction-to-clojure$ git checkout -f 3.7
Branch '3.7' set up to track remote branch '3.7' from 'origin'.
Switched to a ...
0
votes
1
answer
16
views
Which option should I choose when executing "i' (Ignore) on Magit? Should Gitignore be shared in private, at the top level or in subdirectory?
I keep my emacs init file under version control. See the GitHub.
I have the things installed from ELPA also unver version control. Which is annoying. After executing Magit status, I have:
Head: ...
7
votes
2
answers
953
views
Pushing/Fetching all branches at once in magit
Context:
I have a relatively small project, in which I use branches to work on new features, so that when I'm finished, then I manually merge branches as I need.
I usually keep the same exact copy of ...
0
votes
0
answers
5
views
How to disable magit-revision buffer from following the cursor in blame buffers?
Open a file in a git repo that is modified by two commits. Run magit-blame.
*author1 date1 commit1*
line1
*author2 date2 commit2*
line 2
Focus on the first line, press Enter. A magit-revision ...
2
votes
2
answers
106
views
magit giterror There was a problem with the editor
When I try to commit C-c C-c with magit, I get this error:
There was a problem with the editor '/snap/emacs/1459/usr/bin/emacsclient --socket-name=/run/user/5019/emacs/server'. ... [Hit $ to see ...
3
votes
1
answer
51
views
Context-aware username (e.g., git username instead of login name) in time-stamp
I am a total emacs/elisp newbie and I can't figure out how to do this.
I have time-stamp-active t with a pretty standard format: time-stamp-format "Last modified %Y-%02m-%02d %02H:%02M:%02S ...
2
votes
2
answers
175
views
How do I change the Magit section heading background color?
I'm trying to customize the look and feel of my Magit setup. How do I change the background color of the section heading below?
In particular, I'd like to change the black background color next to ...
1
vote
1
answer
60
views
Undo stage hunk in magit
If I accidentally staged a hunk that I wanted a better look at, how do I undo that action (the most recent action). C-/ does not work.
Sure I can U to unstage all, but say all else staged is valid.
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.
...
0
votes
2
answers
100
views
Can't commit in Emacs 29.0.50 , magit 20220412
I'm running emacs version 29.0.50, with the most recent magit and since yesterday I've not been able to create (or amend) a single commit.
*ERROR*: Not inside Git repository
error: There was a problem ...
0
votes
1
answer
71
views
Load right version of Git while connecting to remote
I am currently working on a remote using Lmod for handling modules. I want to use Magit with the repositories on this remote, but the default system version of Git is 1.x.
However, Git 2.18 is ...
1
vote
1
answer
55
views
Make Magit ignore certain files already added to git and to .gitignore
This question is related to this previous question.
These two files below are under version control which causes some inconvenience in magit-status:
Unstaged changes (2)
modified .emacs.d/projectile-...
2
votes
1
answer
57
views
How to properly use Magit Fixup?
I am trying to use the Fixup feature on Magit. I will list a recipe to what it is happening:
(i) - I have a project under version control.
(ii) - My first commit is:
1f61d09 * first commit: add file
...
1
vote
0
answers
34
views
Magit ediff range in a pretty way?
I need to investigate a project, with a patch made by a former student of my university. He made a series of commits on a repo, and I need to see what additions he made.
I got the list of files ...
0
votes
1
answer
30
views
In Magit, what is the difference between stashing "index", "worktree", or "both"?
Honestly, I have always picked both and it has worked out so far. But I do not know in which concrete cases it would be better to pick one over the other. It would be good to see examples.
I tried ...
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, ...
2
votes
1
answer
34
views
How to insert a flyspell hook on Magit via `use-package` declaration?
I am rewriting my Emacs config file to fully use use-package and organize code. Currently, I have
(use-package magit
:custom
(magit-display-buffer-function #'magit-display-buffer-same-window-...
0
votes
1
answer
96
views
Ignoring specific remotes when running `magit-log-popup` to log all branches
I would like to add an option in magit-log-popup to ignore a list of remotes when using "Log all branches" (l b). What I'm trying to do is something like this git log HEAD --branches --remotes --not -...
0
votes
0
answers
29
views
Magit No Longer Recognizes My Global Config
Overview
This is a new issue for me that started about a week ago.
I started having issues with some git commands in when using magit and vterm recently. Specifically, git couldn't read my global ...
0
votes
1
answer
45
views
MAGIT: easier to read diffs
Is there a way in MAGIT to see diffs as one line instead of two with deletions and additions in one line? It would be much easier to navigate.
2
votes
0
answers
54
views
how to teach magit to pass multiple push-options at once
GitLab has a few push options for which I'd like to create switches in magit-push's transient.
Causing -n to add -oci.skip is simple enough:
(transient-append-suffix 'magit-push "-n" '("...
1
vote
1
answer
20
views
How do I make Magit use the active window for operations and, on-exit, return the window to the previous buffer?
I am a recent newcomer to emacs, and I have my screen split into 4 windows in a grid arrangement. I'm having some problems using Magit, which is that it spawns (seemingly arbitrarily) in one of the 4 ...
2
votes
1
answer
43
views
Is it possible to do a git clone using Magit in a directory which is not under version control?
Suppose I am in a folder called local-projects. Using the terminal, I can do:
[pedro@system:~/quicklisp/local-projects]$ pwd
/home/pedro/quicklisp/local-projects
An important information to ...
1
vote
1
answer
34
views
How to customize the magit-todo display
I use Emacs to write documentation, and a lot of times my files end up with some internal markup that looks like this: [TK: Where is the event handler defined?] in-line with the text. (“TK” is writer ...
1
vote
2
answers
574
views
magit-status open selected buffer change hunk in other window rather then in the same window
I used to have this functionality using code below:
(setq magit-display-file-buffer-function
(lambda (buffer)
(setq current-prefix-arg t)
(magit-display-file-buffer-traditional ...
0
votes
0
answers
19
views
Hide projectile-files-errors
My Issue: I'm getting a fatal error due to a missing url for a submodule path in a project I'm working on.
Desired Result: Every time I run Projectile to grep my project, I end up getting the annoying ...
0
votes
0
answers
41
views
Close all open Magit buffers when opening a new project
When using Magit, the multitude of buffers can become a bit confusing when switching buffers. Therefore I prefer to have only one git-repository open in Magit. My current procedure of switching to ...
0
votes
0
answers
34
views
Cannot invoke transient magit-pull while minibuffer is active
I'm using magit. When I try to pull or commit, I get this message in the mini-buffer:
Cannot invoke transient magit-pull while minibuffer is active
I can assure you, I have closed every magit-related ...
0
votes
0
answers
49
views
How to make `git fetch` `git rebase origin/master` work in Magit?
I have a branch that I have been working on. At the same time, master branch was evolving.
I decided to put my local branch changes on top of master new changes. Thus, after pulling changes on master, ...
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 ...
1
vote
2
answers
59
views
How to git reset --hard HEAD~1 in Magit?
I accidentally inserted 1 commit in my local master branch. I have not pushed this changed and I want to remove it. This was supposed to be in a new branch.
So, I created a new branch based on master ...
1
vote
1
answer
26
views
Is there a "follow-mode" when moving through a magit-log (or similar buffers)?
I have some recollection that there was something like a "follow-mode" for some magit buffers (e.g., magit-log). The idea was that I could pull up a log (e.g., with C-x g l l), put point on ...
1
vote
1
answer
30
views
Using magit-add-section-hook in spacemacs startup
I am attempting to use magit-add-section-hook in dotspacemacs/user-init.
(defun dotspacemacs/user-config ()
;; Magit pull submodules. Don't know why this fails.
(magit-add-section-hook 'magit-...
0
votes
0
answers
20
views
MAGIT: is it possible to visualize only deleted portions of commit?
As part of my workflow with Magit, I like checking the red parts (deleted) changes of my commits visually quickly when committing in Emacs, given that in Emacs I must be careful not to chunk huge ...
0
votes
0
answers
20
views
Limit magit-log-all
I'm using magit on Emacs 27.1 on a project with a lot of commits (27000). When I first start magit-log-all it shows about 80 commits which is fast, but if I increase the log for any reason then next ...
0
votes
1
answer
19
views
How to repeat last magit search and modify an option?
Searching through the git log with magit is a breeze. When I do a complex search, I may pass five arguments. If I then realize I want to search again with one option changed, how can I get all search ...
1
vote
2
answers
71
views
How to make the writing of my commit messages faster in Magit?
I am using Magit. After staging some changes, when I press to commit something, Magit opens a buffer like this:
# Please enter the commit message for your changes. Lines starting
# with '#' will be ...
0
votes
0
answers
118
views
Setup Magit Forge to connect Gitlab
I am using a Gitlab, say gitlab.company.org. My username on that machine is user and I am using 2FA.
I have read the Forge User and Developer Manual. It asked to read and follow the instructions of ...
0
votes
0
answers
39
views
Pushing a gitlab release
Is there a way to push via Magit, so that the push will automatically produce a release in GitLab?
For example: I prepare my files, open the Magit status buffer, stage the file via s, commit the file ...
1
vote
2
answers
37
views
How to control the number of characters for the SHA1 displayed in Magit's log view?
I've noticed some repositories use 7 characters, others 11 when displaying a SHA1.
It looks as if magit uses the output of git log --pretty=oneline --abbrev-commit however I can't see how to configure ...
37
votes
2
answers
5k
views
How to stash individual files with magit
git is capable of stashing of individual hunks.
With --patch, you can interactively select hunks from the diff between HEAD and the working tree to be stashed. The stash entry is constructed such ...
0
votes
0
answers
15
views
Jump to last staged hunk
Inspired by this question and workaround:
...stage the whole hunk, and then unstage the line which you don't want...
How do you jump to the last staged hunk in Magit?
0
votes
0
answers
10
views
Let `magit-insert-local-branches` sort branches according to the branch.sort configuration
Is it possible to configure magit to sort branches inserted with magit-insert-local-branches into the main status page according to some criteria, for example whatever is configured as branch.sort in ...
0
votes
0
answers
17
views
How can I disable projectile-mode in certain buffers? [duplicate]
I have (projectile-global-mode) enabled and I'd like to disable projectile-mode in certain buffers (e.g. the magit status buffer) so that their keybindings don't interfere. Is there a way to do that ...
0
votes
0
answers
24
views
How can I disable `diffing` in magit during git commit?
When I commit using magit (git-commit-mode) shows following message Diffing changes to be committed (C-g to abort diffing) in the mini-buffer before typing the commit message.
Would it be possible to ...
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 ...
1
vote
2
answers
225
views
Unset local key binding in `magit-status`
I want to remove magit local key binding for C-w (to use global one).
But can't find which hook I can use for that.
1
vote
2
answers
196
views
Corrupt Git configuration in magit
I updated My macOS to Monterey. After that, magit command yields "Corrupt Git configuration". I uninstall emacs and magit and install them again, but it does not resolve. How do I fix that?
0
votes
2
answers
150
views
How to debug error in process sentinel?
I've recently switched to doom emacs, and for the most part it's working great.
However, when I'm looking at a folder in dired-mode, if I copy a file using C the file is copied but *Messages* contains ...