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
0
votes
0answers
24 views

Magit pull with merge/rebase from upstream/pushRemote

I have upstream set to develop branch (say origin/master) and pushRemote to feature branch. I currently use pulling with preserving rebase. I would like to setup magit in such a way that: this ...
5
votes
1answer
36 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&...
0
votes
0answers
13 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
10 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 ...
1
vote
1answer
41 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 ...
3
votes
1answer
102 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 ...
1
vote
1answer
35 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
0answers
16 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
0answers
19 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
51 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
74 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 ...
1
vote
1answer
32 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/...
0
votes
1answer
28 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
44 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 ...
0
votes
0answers
42 views

Connection problem to Github

When I try to evaluate a Quelpa expression that fetches a package from Github, it throws the following error Debugger entered--Lisp error: (error "Command ’(env LC_ALL=C git clone https://github.com/...
0
votes
1answer
143 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 = ...
0
votes
0answers
264 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, ...
3
votes
2answers
240 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
1answer
124 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
1answer
44 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
0answers
111 views

Show Git gutter after linenumbers

I am using emacs-nox and as some of you know there are always some problems if you want to display you line numbers while also using git-gutter. (Stuff like some extra margin jumping numbers etc.) ...
1
vote
1answer
168 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 (...
2
votes
0answers
92 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 ...
1
vote
1answer
77 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 ...
4
votes
1answer
236 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 ...
1
vote
1answer
77 views

pipe buffer contents to shell as pseudo-file

I'd like to use wdiff to compare the contents of the current buffer to a previous version of the file the buffer is visiting. So, this would be a word-level live diff of the current buffer against a ...
4
votes
1answer
963 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?
2
votes
1answer
157 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-...
6
votes
1answer
199 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 ...
3
votes
1answer
39 views

Exclude magit autosaves from git log --all?

I like the idea of (magit-wip-after-save-mode) but it makes git log --all (or la in Magit) very cluttered. Is there a simple way to exclude autosaves from all the autosave "branches"? On the command-...
2
votes
1answer
392 views

emacs prompting for github password

I've recently switched from spacemacs to radian and have suddenly run into magit prompting for my github password whenever I view the status of a repository (the repository is configured to use SSH). ...
4
votes
1answer
75 views

Can I move lines when committing parts of a hunk in magit?

I prefer to have small and focused commits but don't always code that way. I've got a code section to the effect of if abc: def etc I edited def and etc, and the hunk in magit shows both as ...
0
votes
2answers
117 views

Show a list of names for all git projects

Windows 10, Emacs 25.1, Helm, Magit I have many git projects in different folders. Is it possible to show list of names for all git projects in one buffer?
2
votes
1answer
439 views

How do I visit a file on a different branch?

I'm aware of C-x v ~ which allows you to see a different revision of the current file, but I would like to visit the file on another branch. Is this possible with magit, VC or git-timemachine?
1
vote
1answer
243 views

Emacs opens gitbash in new system window

I've try to follow this question and sulution Git Bash in emacs on Windows I have this function: (prefer-coding-system 'utf-8) (defun git-bash () (interactive) (let ((explicit-shell-file-name "C:/...
1
vote
1answer
259 views

Git commit line length constraints

I'm quite new to emacs and a lot of the documentation I'm finding online is going over my head a bit at the moment. I've been using emacs as my git editor for a while now by mostly eye-balling ...
0
votes
1answer
133 views

git-commit-mode with flyspell very slow

I use emacsclient as my git commit editor. This is what I have in my init file: (require 'git-commit) (add-hook 'git-commit-mode-hook 'turn-on-flyspell) I just made a huge commit (update of a third-...
0
votes
3answers
185 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 ...
4
votes
2answers
349 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 ...
1
vote
1answer
1k 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
127 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
68 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? (...
0
votes
1answer
24 views

Rewriting all file when save some changes

I work on Rails project in my Emacs25. When I change one specific file and save changes I got all file changed (from git diff). But when I try to old and new versions of this file in Meld - I get ...
3
votes
1answer
624 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 ...
3
votes
1answer
376 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 ...
4
votes
1answer
287 views

Show git branch in dired modeline

I would like to see the git branch shown in the dired mode-line at least for the top directory of git projects. Anyone done this or know how to?
2
votes
1answer
271 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 ...
5
votes
2answers
369 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
2answers
2k 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.
1
vote
1answer
141 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 ...