Questions tagged [git]

is for Emacs support of Git, the distributed version control system. Emacs `version-control` feature supports many systems besides Git. Additional extensions, such as `Magit`, also provide extensive Git support. Therefore use additional tags besides `git` for Git related questions.

Filter by
Sorted by
Tagged with
4
votes
2answers
1k views

Using `emacsclient` as `git config core.editor` and invoking `git commit` as `shell-command` in Emacs?

I am trying to use Emacs 25.1.1 (graphical version, Windows 10) as both the primary editor and the editor for git operations. In my workflow, I invoke git through M-x shell-command. I tried the ...
1
vote
1answer
219 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
266 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 ...
2
votes
1answer
539 views

magit blame: how to go to the commit my cursor is currently on

I want to checkout the file as it was when before the commit was applied so I can dig deeper. Now I just resort to command line git to do that.
1
vote
1answer
617 views

How do I do a `git add` with vc-git?

I want to stage a file or a hunk using vc-git (the vc system that comes with Emacs). How do I do this? (To clarify, I made modifications on a file that is already (registered) in git. I would like to ...
5
votes
1answer
536 views

How do I stop Emacs micro-stuttering and high CPU utilization caused by background calls to git?

Using Emacs on Windows, I experiences issues due to background invocations of git.exe. The same issues might apply on Linux, though the more light-weight process calling might make them unnoticable. ...
0
votes
1answer
119 views

View the log of the staged files while editing a git commit message

When I'm editing a Git commit message, I sometimes like to browse recent commits to the same file(s). That is, I'd like to view the output of git log $list_of_files_with_staged_changes. Git commit ...
0
votes
2answers
157 views

Is there a common way to open “svn-status” or “magit” depending on current buffers system?

before I sit down and reinvent the wheel for me: I'm working with svn and git in different projects. Is there already an existing way to start svn-status or magit, depending on the vcs that is used ...
3
votes
0answers
95 views

How do I get magit to run: git push origin HEAD:refs/for/master ? (gerrit) [duplicate]

Gerrit has a magical reference (refs/for/master) that when you push to submits your commit to the code review system. I haven't been able to figure out how to get magit to push to this. I'm not sure ...
5
votes
2answers
2k views

Advanced git grep from within emacs

I've been playing with vc-git-grep as pointed to by this answer How do you grep from within emacs ( git grep 'foo' | grep baa ) I have a special requirement like this: $ git grep -e 'include'...
2
votes
1answer
301 views

How do you grep from within emacs ( git grep 'foo' | grep baa )

I do this often after shelling out to bash $ git grep 'banner-image' | grep mb3 Can I do it without leaving emacs?
14
votes
1answer
1k views

Is there bitbucket integration for emacs?

I am looking for listing pull requests on bitbucket that I created from emacs. I found this https://github.com/tjaartvdwalt/bitbucket.el, which seems to be incomplete. Is there any other package out ...
1
vote
1answer
312 views

utf-8 characters with eshell, eshell-visual-subcommands, and git

Using the configuration (eval-after-load "em-term" '(progn (add-to-list 'eshell-visual-subcommands '("git" "diff" "help" "log" "show")) (add-to-list 'eshell-visual-options '("git" "--help"...
2
votes
1answer
943 views

Unable to use git in shell inside a buffer

I used 'M-x shell' to start a shell inside a buffer. Then I tried to run git diff After I press the space bar a few time, the lines 29-69/69 line is printed a few and the shell has stopped responding....
17
votes
1answer
8k views

Magit - Undo last commit - History Manipulation

This StackOverflow question has the best solutions/approaches to undo last commits. I started using Magit a couple a weeks ago and after looking through all its documentation I still don't have a ...
0
votes
1answer
194 views

Magit fetch all repos from GitHub

I have just installed Magit and so far all is going great! However, I have a lot of GitHub repos that I would like to fetch via Magit. Is there a way to fetch all repos from GitHub?
2
votes
1answer
184 views

Insert and expand snippet when committing with Magit

I use a template with Git for keeping my commits messages neat and professional, as explained here. However, since I use Magit, I would like to insert and expand a snippet with Yasnippets because ...
3
votes
2answers
414 views

should I gitignore my elpa/gnupg directory?

I keep ~/.emacs.d/ under version control with git. I used to gitignore the elpa/ directory, but recently started including it in case I ever want to rollback a package upgrade. I just noticed an ...
3
votes
1answer
356 views

Magit diff working file to commit in log?

How does one ediff a current file--ie working tree--against an arbitrary version in some previous commit? In this case, I'm interested in pulling in some, but not all, changes from a commit in ...
2
votes
2answers
985 views

Turn on auto-fill-mode when editing a commit message with Magit?

I have tried: (add-hook 'git-commit-mode-hook '(lambda () (setq fill-column 72) (turn-on-auto-fill))) In both cases, auto-fill-...
5
votes
3answers
299 views

Package manager: which files not to add to git?

I'm keeping my config-files in a git repository to use it on multiple different machines. I'm using the emacs package manager, but I don't want to add the packages to git, because which packages have ...
0
votes
1answer
66 views

Is that possible to Emacs to respect .gitattributes and .hgeol?

Is that possible to Emacs to respect .gitattributes and .hgeol? I am again on Windows with Cygwin emacs-w32 and would like if Emacs honor project specific CR/LF settings for new files...
0
votes
2answers
1k views

How to use OSX command line GUI emacs as git $EDITOR

I have a script to launch OSX GUI emacs from command line at: /usr/local/bin/emacs The script looks like: #!/bin/sh $(/Applications/Emacs.app/Contents/MacOS/Emacs --chdir $PWD "$@") & I have ...
5
votes
2answers
3k views

Magit how to use ssh key rather than being prompted for password

I've seen the question here but I'm not sure if the same solution would apply to me Magit, how to use system's ssh agent and don't ask for password I'm on Emacs 25.1 / Ubuntu 16.04. I've just ...
3
votes
1answer
121 views

Does git-messenger support showing a commit using Magit?

In this issue in git-messenger's issue tracker it was suggested that it should optionally use magit-commit-mode to show commits in a separate buffer. And that issue was closed as resolved. But it ...
2
votes
2answers
129 views

VM causing magit not to work

I have this error when I start emacs: File error: Searching for program, no such file or directory, git My Git is inside the VM in /usr/bin/git How can I point emacs to it? I'm using tramp and ...
2
votes
1answer
127 views

Does magit support interactive git hook?

My git hook would prompt for answer yes/no when do the push. How could I get the prompt and enter my input when using Magit?
7
votes
1answer
520 views

Magit: how remove push branch?

I want to remove the push branch for a repository. I only use merge branch to push to a remote repository and now I have two headers with the same info all the time: Head: master Merge pull ...
0
votes
2answers
420 views

Use remote git executable for magit and git-gutter when file system is SSHFS

How can I use a remote git executable for all git operations when accessing a file via SSHFS? I mount a remote system's git repo via SSHFS on my local computer. The git repo is medium-sized with ...
1
vote
2answers
595 views

vc-git doesn't recognize that file is under version control

I initialized a Git repository outside emacs, added and committed the files. Now if I a file in emacs that is under version control by Git and run C-x v = emacs tells me This file is not under ...
0
votes
1answer
340 views

magit - triangle workflow with branches in fork

I am using a triangle workflow. Upstream is called upstream and my forked repository is called fork. I want to have multiple branches and each of those branches should exist both locally as well as ...
3
votes
1answer
168 views

Open files in git repo that have been edited since a previous commit or branch

Is there a way to provide a list of files that have been edited since a previous commit or branch with helm and projectile integration? The use case is as follows: Create feature branch feat-my-...
4
votes
2answers
3k 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?
0
votes
1answer
144 views

How to remove git stashes when inside magit-status

Inside the magit-status, I see tons of stashes. Can I removed them by pressing a key on the keyboard?
3
votes
1answer
763 views

How do you do “git checkout — .emacs” using magit?

When a file (like .emacs for example) is modified in a Git repository, if I want to git pull git refuses to do so because I have a modified file. Git proposes to remove the modification by doing git ...
1
vote
1answer
183 views

Why is the Projectile Git repository being set to the most recently cd'd directory?

When I run projectile-find-file in GUI (non-terminal) Emacs, the project directory is set to the directory I most recently cd'd to in a terminal window. Let's say that I have a home directory not ...
0
votes
1answer
300 views

Can I exclude .git/COMMIT_EDITMSG from file-name-history?

Is there a way to exclude .git/COMMIT_EDITMSG files from file-name-history? Now that I'm authoring commits with Magit, those commit message files are often the most recent entries in file-name-history,...
1
vote
2answers
306 views

super detailed vc-change-log

When I do l (vc-print-log) in the *vc-dir* buffer, I get the *vc-change-log* buffer with a single line per commit. Even when I can hit RET (log-view-toggle-entry-display) there to get the details, I ...
2
votes
2answers
261 views

undo vc-annotate-revision-previous-to-line

When I've launched vc-annotate and then type a (vc-annotate-revision-previous-to-line), emacs will show me the revision before the one on the current line. From the docs: a Annotate the ...
53
votes
4answers
12k 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 ...
0
votes
1answer
90 views

Open set of buffers based on git branch

I'm very new to emacs, but from what I understand it should be able to do almost anything. Something I have wanted in my IDE for a long time, is a bunch of open files, based on a git branch. I do dev ...
2
votes
2answers
2k views

magit-stash-create: Cannot save the current index state

I'm using magit 20160517.838, Emacs 25.0.50.2 I just upgraded magit from 20160320 to 20160517 and when I try to stash I now get this issue; magit-stash-create: Cannot save the current index state I ...
1
vote
2answers
857 views

How can I enable git auto-commit on a per-file basis?

Can I perhaps add a hook via local variables in the file header?
3
votes
1answer
717 views

Function of org-clock-save.el file and Git related question

I'm asking this question because I'm personally confused on how org-clock works in general. My org-clock-save.el file only has one line, ;; org-persist.el - PCNAMEHERE at <2016-04-24 Sun 11:16&...
2
votes
1answer
459 views

How do I make Magit only show diff for unstaged changes?

The default git behavior is to show only unstaged changes (ignoring stuff that I have staged/git added). How do I do that in Magit?
0
votes
1answer
179 views

Emacs build error when use “autogen.sh all” to generate configure for master branch

I just cloned the source and try to build Emacs under my debian Jessie, but has some problems: [23:31:04 coeus]$ ./autogen.sh all Checking whether you have the necessary tools... (Read INSTALL.REPO ...
5
votes
1answer
284 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 ...
1
vote
1answer
199 views

magit equivalent of gitk's “Diff this -> selected”

gitk has a feature where you select one commit, then right-click another and can choose to either "Diff this -> selected" or "Diff selected -> this". Is something like this possible in magit-log? ...
3
votes
1answer
420 views

How do you hook up git to emerge through emacsclient?

I previously had the following script in a file called .emacs.d/emerge-for-git: #!/bin/sh emacs -Q $* And In my .gitconfig: [merge] tool = emerge [mergetool "emerge"] path = /home/rovanion/....
13
votes
2answers
13k views

How can I use emacs with git within the terminal?

I've used git config --global core.editor emacs to set my git editor as emacs but when I do that and commit something the editor opens up a new window instead of opening emacs within the terminal. I ...