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
3
votes
2answers
863 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 ...
0
votes
1answer
17 views

Magit Move Submodule

In git bash I can use git mv home/subdir_1/my_submod home/subdir_2/my_submod to move a submodule between directories. Git handles changing .gitmodules and stages the change to be committed. Is there a ...
2
votes
2answers
374 views

Elpy starts Python processes at the root of my git tree, not the module's actual location

(I now submitted this as an issue in GitHub: https://github.com/jorgenschaefer/elpy/issues/1249) I'm using Emacs 25.3.1, Elpy v20171212.850, and Python 3.6.3 on MacOS 10.13.2 . I have a project ...
0
votes
0answers
21 views

magit status and git lfs files diff shows pointer diff

When I call magit-status git lfs files are shown as follows. modified src/myfile @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:...
2
votes
1answer
56 views

How to develop a package I also have installed?

When developing a package which is also installed via an online repository, there is a practical problem. /source/my-emacs-package git repository where I have my code. ~/.config/emacs/elpa/my-emacs-...
2
votes
1answer
97 views

Error when loading new version of org mode

I upgraded Org-mode to the latest version on the master branch (according to How to install latest version of org mode?) and now I get this error every few seconds: Error running timer ‘org-indent-...
1
vote
1answer
64 views

Git Texinfo indices missing

I have installed the official Git documentation in Texinfo format on my computer and for Emacs. But when I try to search for something with I in the info buffer (C-h-i d m git) it reports no indices. ...
0
votes
1answer
45 views

Is it possible to force `markdown-mode` during git commit?

I was using following answer: https://emacs.stackexchange.com/a/57535/18414 to set markdown on the .git/COMMIT_EDITMSG file. (add-to-list 'auto-mode-alist '("/\\.git/COMMIT_EDITMSG\\'...
3
votes
1answer
117 views

Cannot get Magit to show the commit signatures in the log

In order to prove that I had a signature on a commit I needed to use a this command line command: $ git log --show-signature -1 I could not get Magit to display the signature I tried to use the ...
0
votes
1answer
32 views

How to stage selected lines / hunks in diff-mode?

Is it possible to stage changes in diff-mode? Or is this only possible with magit+ediff?
1
vote
1answer
98 views

How to search certain subdirectories of directories that are ignored by Git

I'm working in a Scala project that has target/ directories entered as ignored in the .gitignore. However, there is also Scala code being generated during the build which is being nested under a ...
1
vote
1answer
26 views

While merging, how to tell Magit to use one version of the file?

When I merge something and there are conflicts, I can go to the file in the magit status page (SPC-g-s) and press, for example, e to start ediff. Within that, I can scroll through all conflicts and ...
0
votes
2answers
55 views

How do I modify magits behavior to use the date that I finalize the commit and not the date that I start the commit

Desired Solution: I want magit to make a commit with a datetime set to the time that I "create" the commit, not the time that I start the commit "creation" flow. Background: So committing in magit ...
16
votes
3answers
5k views

Magit extremely slow in Windows. How do I optimize?

I am forced to use Windows 10 for a project. Yes, I would rather use GNU/Linux. To keep my sanity, I've tried to regard Windows as a bootloader for Emacs :) Unfortunately, Magit (one of my favorite ...
1
vote
1answer
112 views

How to get sorted output from counsel-git-grep with ivy?

When using git-grep, the output isn't sorted alphabetically which makes navigating the results more tedious then it should be. Is there a way to sort the output? I checked git-grep and it seems ...
0
votes
1answer
40 views

el-get Basic Setup (https://github.com/dimitri/el-get) : error: Unable to find 'git'

Start Emacs from gitbash (MINGW64) Snippet below is loaded automatically: ; add el-get to the load path, and install it if it doesn't exist (add-to-list 'load-path "~/.emacs.d/el-get/el-get") (...
6
votes
2answers
3k views

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

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.
1
vote
1answer
47 views

How do I associate a file such as git's `COMMIT_EDITMSG` with a specific mode?

I was doing following solution for markdown files: How do I associate a file extension with a specific mode? (autoload 'markdown-mode "markdown-mode.el" "Major mode for editing Markdown files" t) ...
5
votes
3answers
486 views

What is the best way to reload git stashed changes you've popped while file is open in buffer?

When I'm viewing a file and then pop a stash which modifies that file in the working tree using git stash pop in either bash or eshell, what is the best way to immediately see those changes in the ...
1
vote
1answer
303 views

How to install latest version of org mode?

I want to update to the latest version of Org-mode to test a bug fix. I followed the instructions: cd ~/src/ git clone https://code.orgmode.org/bzg/org-mode.git cd org-mode/ make autoloads Then I ...
1
vote
1answer
57 views

How to activate diff-mode from command line?

Git's editor config is set to launch emacs in no-window mode and to execute lisp function diff-mode: git config --global core.editor "emacs -nw -f diff-mode" However, when I execute git commit -v to ...
0
votes
2answers
103 views

How to match the nondirectory part of a filename with a regular expression?

Whats the correct way to match a filename from a full path using string-match-p. Say I want to check if the file is a git commit message COMMIT_EDITMSG or svn-commit.tmp or svn-commit.3.tmp to pass ...
3
votes
1answer
59 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 ...
0
votes
1answer
65 views

How to abort an ediff merge?

I use ediff to merge mercurial conflicts (and sometimes git conflicts), but I can't seem to abort. Ediff pops up as soon as a conflict is detected, and quitting and not saving results in mercurial ...
1
vote
1answer
313 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 ...
0
votes
1answer
66 views

Magit pull with merge/rebase from upstream/pushRemote

I have upstream set to the develop branch (say origin/master) and pushRemote to a feature branch. I currently use pulling with preserving rebase. I would like to setup magit in such a way that: ...
1
vote
0answers
28 views

Git status on modeline to indicate if behind remote?

Can I get Emacs to indicate on the mode-line whether a push is needed, i.e. whether the repo is out of sync with origin? I've already got it telling me if a commit is needed using vc-status, but that ...
3
votes
4answers
480 views

Set author per repository

I work on both work and personal projects on my machine, and for my work projects, I prefer to use my work email, and vice versa. In shell, I use direnv to set GIT_COMMITTER_EMAIL and ...
1
vote
1answer
95 views

Magit merging changes manually

When I do merge preview m p I see a log of other branch changes for each affected file. Changes marked like this: @@ -20,6 + 22,7 @@ - <change> + <change> To merge only a ...
5
votes
1answer
47 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&...
2
votes
0answers
145 views

Nested git repositories that behave like one project with projectile

I am trying to understand how to use https://projectile.readthedocs.io/en/latest/projects/#customizing-project-root-files but it is not clear yet. My goal is to have nested git projects. Let's say I ...
0
votes
0answers
16 views

Doing grep on files after doing helm-grep-do-git-grep?

For example, you helm-grep-do-git-grep with foo Helm will give you list of matching lines. Let's assume there are 100 matching lines in 12 files. I want to do helm-grep-do-git-grep with bar on those ...
0
votes
0answers
52 views

When I use emerge as a git difftool how can I get the output file?

I try to merge two commits using git in MSYS2. I need to do it manually, because I need to recover accidently removed text from a previous commit and automatic merging always removes it. I use git ...
9
votes
3answers
2k views

Get git repo root directory, preferably with magit

How can I get the root directory of the current git repo? I could run shell-command-to-string on something like git rev-parse --show-toplevel. Is there a better way? Does magit or any other git front-...
3
votes
1answer
195 views

How can I back up my init file with Git?

The docs say to keep the .emacs file in the HOME directory. I'd like to share the file between multiple computers using a git repo. What is the best way to structure the repo without including ...
0
votes
2answers
498 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
0answers
25 views

how to get line wrap to had return at puncuation

I've see a few similar questions: Editing files with one-sentence-per-line https://stackoverflow.com/questions/41637313/how-to-make-a-function-that-straights-out-each-sentence-in-a-paragraph-to-...
0
votes
3answers
282 views

Edit commit messages in markdown mode

I configured git so that it uses emacsclient when editing commit messages. The only problem is that these messages are edited in fundamental-mode. Which hook should I use to have these commit messages ...
0
votes
0answers
30 views

Is there is an existing parser for `.gitignore` files?

Is there is an existing parser for .gitignore files? Maybe there is some Elisp package that includes something like this? Ideally, I would like to be able to read a .gitignore file in a given ...
4
votes
1answer
103 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 ...
4
votes
1answer
91 views

Disabling automatic add after resolving git conflict

After updating emacs (to 25.2.2 as shipping in ubuntu 18.04) I notice a change that completely breaks my conflict resolution flow in git. Once I resolve a conflict using emacs and save the file, emacs ...
95
votes
3answers
25k views

How to merge Git conflicts in Emacs

My recent Git merge has resulted in a large number of conflicts. My current approach is to search for the next occurence of '<<<' and then perform the merge by standard text editing. ...
1
vote
1answer
37 views

how to copy a deeply nested binary file from one git repo to another [closed]

I want to copy an image file from one github repo to another. The source and destination file paths are deeply nested within the repo (eg. copy ~/code/repo1/src/components/A/components/B/common/...
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 ...
4
votes
2answers
565 views

Using auth-source with magit and bitbucket

The code base I'm working on has recently moved from ssh key controlled git to https bitbucket. I use Magit to handle my version control in Emacs. In the old ssh world I was never challenged for my ...
0
votes
1answer
51 views

How to specify multiple patch files to be applied by Magit?

The Magit user manual says in the description of `w w' (magit-am-apply-patches): w w (magit-am-apply-patches) This command applies one or more patches. If the region marks files, then those ...
1
vote
1answer
225 views

How to ask magit to use external diff and merge tools?

I have set the git variables [merge] and [diff] to the appropriate values like this: [merge] keepBackup = false; tool = p4merge [mergetool] prompt = false [mergetool "p4merge"] cmd = ...
3
votes
2answers
323 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 ...
0
votes
0answers
468 views

Alternatives to Git on Windows due to its slowness

I am forced to use Windows 10 on my job, so I use native Win32 Emacs. Also use Emacs on WSL (compiled from emacs mirror though tried the default Ubuntu 18.04 too). I tend to use more the one on WSL, ...
2
votes
1answer
50 views

Package to help display status of each git repo contained in a common directory

I have a directory and in the directory is a rather long list of git repositories. Is there a package or options where a dired listing of the directory would also add in the status of each git repo ...