Stack Exchange Network

Stack Exchange network consists of 174 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.

1
vote
1answer
27 views

How to configure git and magit to stream line making pull requests?

From the main repository on github, I created a fork on github and I keep the master branch of my fork up to date with the main repository by doing: git checkout master git pull upstream master git ...
0
votes
2answers
49 views

Magit: Getting to the current/editable version of a file from a commit/diff view

Very similar to this question, particularly the second part to this answer: From the diff view of a specific commit, is there a way to jump to the current+editable version of a modified file? If I ...
0
votes
1answer
36 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 ...
0
votes
1answer
18 views

Magit: add a full directory with magit-status

How can I add a full new directory with magit-status? When trying to stage a new directory from the magit-status buffer, pressing s, I can only add individual files within the directory, but not the ...
1
vote
1answer
34 views

Can magit commit with all (-a / --all) instead of “.” by default?

When using magit-commit-create, internally it runs something like... git commit . instead of... git commit -a Is there a way to make magit use -a / --all by default instead? Note: this is an ...
5
votes
1answer
28 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 ...
7
votes
2answers
649 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?
0
votes
1answer
22 views

Set magit timestamp format with function

I would like to have my git timestamps in UTC. Currently attempting to commit using magit gives Wrong type argument: sequencep, my/magit-timestamp-utc Here's the code: (defun timestamp-now() (...
0
votes
1answer
30 views

How to prevent Magit from saving COMMIT_EDITMSG?

When I hit c c in the Magit buffer it opens the commit message buffer. Then I write my message and type C-c C-c to close it. For some reason it saves .git/COMMIT_EDITMSG and every next time when I hit ...
1
vote
2answers
223 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-...
0
votes
1answer
112 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 ...
0
votes
1answer
34 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 -...
1
vote
1answer
113 views

Magit status is slow on Linux insided virtual machine but fast on native MacOS

In OSX El Capitan, I am using Magit 20171026.217, Git 2.10.1 (Apple Git-78), Emacs 25.1.1, darwin. In CentOS Release 6.6, I'm using Magit 20180903.2339, Git 2.13.1, Emacs 26.1, gnu/linux. For the ...
1
vote
1answer
104 views

Modify last commit's message and push to upstream

I'm thinking about automating my following git workflow in emacs: checkout to a new branch remove some pattern in the last commit message commit (amend) it push it to upstream How could I automate 4 ...
3
votes
2answers
34 views

How to turn off Magit default switch (--reset-author in Commit)

I did something causing the -R (--reset-author) switch in the Commit menu to always be on by default. How can I reset this?
1
vote
1answer
27 views

How to detect programmatically if content under org-mode headline is encrypted or not before a save or commit?

org-mode allows users to encrypt the contents under a headline by adding the crypt tag with C-c C-q crypt and then calling M-x org-encrypt-entry. Below is an example using this feature: * Headline ...
1
vote
1answer
34 views

magit-run-git-with-editor: Invalid function: with-editor*

today, using magit, I've started getting the following error message when I hit c to commit : Terminal is dumb, but EDITOR unset In the *Messages* buffer, I also get: magit-run-git-with-editor: ...
0
votes
1answer
61 views

Track org-mode headlines separately with version control

I want to setup a personal wiki in Emacs org-mode. And I want to put this under version control, so that I can see the history of each article, as it evolves. If I use a single file for my wiki, with ...
7
votes
3answers
286 views

Magit: Copy text from Stage section without character “+”

Windows 10, Emacs 25.1, Magit I select some text (Shift + Arrow Down) from the Unstaged changes section. Here is a screenshot: Then I paste into another buffer (*scratch*). This is the result: Is ...
1
vote
2answers
50 views

Prevent any form of ESC from closing a magit buffer

I'd like to be able to prevent Magit from closing a buffer when I press ESC. I also want to prevent my evil-escape-mode sequence (kj) from closing it as well. Running C-h k ESC gives <escape>...
5
votes
3answers
158 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 ...
1
vote
1answer
351 views

Error (use-package): Cannot load magit

I am not sure if that is a problem on my site or more people are experiencing this. I thought at first that I broke something in my config file, but after loading by backup .emacs.d, the error is the ...
0
votes
1answer
46 views

How rollback settings without restart Emacs?

windows 10, emacs 26.1 In my init.el (with-eval-after-load 'magit-status (define-key magit-status-mode-map (kbd "C-<tab>") nil)) This disable C-<tab> after magit-status was load. And ...
0
votes
1answer
39 views

Magit: How disable C-<tab>?

windows 10, emacs 26.1, I use package magit to work with git. Nice. When I press C-<tab> is collapse/expand recent commits: Nice. But if I press <tab> magit do same thing as when I ...
6
votes
1answer
206 views

How to perform an automatic commit with predefined message using Magit?

I have a repository of org files which I mostly use for note taking and tracking, and I track it using git. I want to add a shortcut that would quickly commit all current content of the repository (...
1
vote
1answer
125 views

How to diff a single, unstaged file in magit-status?

How can I display a diff for the actually selected file in magit-status? What can I do in do display a diff of build/conf/local.conf? With the now deprecated git-status, I could run git-diff-file (...
0
votes
2answers
466 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 ...
0
votes
2answers
653 views

Magit commit error: “cannot spawn sh” + “cannot start editor”

When I try to commit using Magit, I get the following error message: 1 c:/Users/chanyoungs/AppData/Local/GitHub/PortableGit_f02737a78695063deace08e96d5042710d3e32db/cmd/git.exe … "commit" "--" ...
2
votes
1answer
35 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....
0
votes
1answer
25 views

How can I get git-gutter:next-hunk to NOT loop around at buffer bottom?

As per the title, I would like to stop processing at the end of a buffer and not loop around to the top. I find it easier to keep track of what I am doing that way. TIA.
10
votes
8answers
947 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 ...
1
vote
1answer
37 views

How can I add custom shell command in magit?

In my project, I write scripts to deploy it to server. Here are the commands: npm run deploy:internal npm run deploy:staging npm run deploy:production I want to add custom shell commands to magit, ...
1
vote
2answers
179 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-...
1
vote
1answer
27 views

what to do with “magit-wip-commit-worktree: Cannot read tree refs/heads/master”?

When I commit via magit I get: magit-wip-commit-worktree: Cannot read tree refs/heads/master while it commits ok. But the message frightens me. There seems to be nothing wrong with the repo: $ ...
5
votes
2answers
269 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
70 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 ...
0
votes
1answer
27 views

magit-diff-visit-file key bindings

While point is inside a diff in a Magit buffer I press RET, which invokes magit-diff-visit-file. After checking this file, I want to quit it and get back to the Magit buffer that was previously ...
1
vote
1answer
25 views

Error (ssh-agency): ‘/usr/bin/ssh-add’ failed with status 1:

(I am using MAC OS High Sierra v.10.13.6) with Emacs v26.1 When attempting to push changes to a remote-repo (Github) using the package magit I received the following error in the buffer. Error (...
32
votes
2answers
4k views

How to list branches with Magit

How do I list the branches of a repository in Magit (i.e., the equivalent of git branch --list)? I expected to find this in the branch popup, but it seems to be neither there nor was I able to find it ...
33
votes
3answers
8k views

What's the Magit equivalent of 'git add'?

What is the Magit equivalent of git add [--intent-to-add] <filename> for checking a newly created file into Git?
4
votes
1answer
82 views

Create patch for one file with Magit

With command line git you can use git format-patch [commit_hash] [file] to generate a patch for a single file. Is there a way to generate a patch in magit for only a single file? I tried marking the ...
24
votes
2answers
7k 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?
14
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 ...
0
votes
1answer
17 views

Opening my windows 10 project with spacemacs via samba/mount will attach wrong encoding to all files

I have a project on my windows machine. I mounted that via samba. Then I access the project with spacemacs. When I run magit now all project fiels have been modified. The actual change is that every ...
1
vote
1answer
97 views

Recover/undo discarded changes in git/magit on unstaged files

I accidentally pressed "k" (a magit command) and discarded some unstaged changes. Is there a way to undo this? Or did I discover one of the few ways to actually lose work while using git?
3
votes
1answer
62 views

How to execute a function in all files in the git working tree?

How to invoke a function on all files in the git working tree, while opening the ones which have had no opened buffers beforehand? A potential use case: Check and fix spelling in all project files ...
1
vote
1answer
78 views

Magit: patches that ignore some whitespace changes do not apply

Context: I'm doing a merge, and fixed the conflicts manually. Now I'm trying to stage changes hunk-by-hunk and make a commit. Issue: some hunks are not getting staged. Here's the output from magit-...
9
votes
2answers
3k views

Magit - How can I checkout a remote branch locally without typing the entire branch name?

I have a remote branch remote-branch-long-name. When I magit checkout with helm completion I can type remote-branch and origin/remote-branch-long-name will show up as an option. The issue is that to ...
0
votes
1answer
48 views

`git add -A` equivalent for magit

I'm a very limited git user and most of the time, I just want to stage commit and push my code without too much ceremony. What's the git add -A equivalent for magit? (I want to do it programmatically)...
1
vote
1answer
36 views

Magit popup set height automatically

When the magit-commit-popup window opens, there are one or two lines that are just below the screen. Calling fit-window-to-buffer in the popup buffer fixes the problem, but I would like to automate ...