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
1answer
24 views

How can I prevent ` running timer: (void-function vc-git-root)` error

vc-git-root walks up the tree until it finds the directory that contains the .git subdir and declares that to be the root of the repo. But if there is not .git folder in the root directory, (vc-git-...
0
votes
3answers
81 views

How can I recursively find and replace in the current git repository

I am working inside a git-repo. Here I want to apply my search operation based on the root directory of the git repo that current buffer is open. Here I do: find-dired "~/my_project" ... in ...
1
vote
2answers
30 views

Open the same file on a different commit

I have a local git repository with a certain git commit checked out. A running emacs instance has an open file inside one of the buffers. How do I quickly open the same file inside a new buffer, but ...
0
votes
0answers
30 views

MAGIT: meaning of magit status: head, rebase, push (git newbie)

In my magit status I see the following: Head: master Commit message Rebase: origin/master Commit message Push: origin/master Commit message I may have done something (pressed some keys) ...
1
vote
0answers
88 views

How to exclude certain directories/files from `consult-git-grep` search?

I want to exlude certain files such as .gitignore in consult-git-grep search. consult-git-grep works find with following defualt setup: (setq consult-git-grep-args "git --no-pager grep -F -n --...
1
vote
0answers
44 views

How to exclude certain directories/files from counsel-git-grep search?

Would it be possible to exclude certain directories/files from counsel-git-grep search, such as .gitignore? Here I don't want to see matches in .gitignore file: I have tried adding ':(exclude)....
0
votes
1answer
35 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 ...
0
votes
1answer
25 views

provide optional parameter for magit

I am tracking my dotfiles by using this approach. This is very useful method to track files which are in different locations. Short summary of the blog. alias dotfiles='/usr/bin/git --git-dir=$HOME/....
1
vote
1answer
18 views

Why this magit process happens after pushing some changes to a remote repository? How to avoid it?

After pushing some changes to a remote repository using magit, Emacs shows this process running: git-credenti... 72390 run *git-creden... /dev/pts/1 git credential-cache--daemon /home/pedro/....
3
votes
1answer
177 views

How to use `--no-edit` flag in a `git commit --amend` process inside magit?

If I am using the terminal, after staging some changes, I can do: git commit --amend --no-edit This will insert the staged changes on the previous commit. The editor to edit the message was not open ...
0
votes
1answer
45 views

Ignore file encoding in diff

My magit diff is full of "differences" where there is no visually discernible change. I've adjusted every Magit Diff Option. Configuring magit to ignore line endings, tabs, whitespace, and ...
0
votes
1answer
41 views

Git track flag in Dired

How can I show an additional column in Dired, where I can see if the file is tracked or not by git in the current branch?
1
vote
1answer
59 views

Why I am unable to squash these commits on magit?

I am trying to squash some commits using magit. I tried two different approaches choosing different commit ids to pick and squash. Despite the fact that none of them worked out, the error messages ...
0
votes
2answers
53 views

Retrieve file from an earlier commit

I am using Doom Emacs 2.0.9 on Emacs 27.2. I use magit to manage a local git repository. In an earlier commit, there was a file. In the latest commit as well as the current working tree, the file no ...
12
votes
1answer
342 views

How can I make 'git diff' aware of Emacs Lisp functions?

When diffing with Git, for most languages, it provides a function name in the chunk header, allowing to get a better grasp on the context, e.g., @@ -7,5 +7,6 @@ int main() { if(condition()) { ...
2
votes
0answers
27 views

How do I jump to the previous/next modification (relative to the git HEAD) in the current file?

How do I jump to the previous/next modification (relative to the git HEAD) in the current file? Ideally, I like sth like swiper that lets me choose to easily jump between modifications.
0
votes
0answers
37 views

Automating git rebase and solve conflict

I have a script can solve some conflict on certain file. How can I automate the work flow to do the following? Run git rebase If has conflict, run script try to solve it. Then run git rebase --...
2
votes
0answers
48 views

Switch README from Markdown to Org, having problem with image rendering

I have a repository on Gitlab, I'm trying to change my README from Markdown to Org, I'm fully able to make the changes, but for reasons the the images are having some sizing issues, they expand ...
0
votes
0answers
19 views

'(auto-revert-tail-mode t t) - duplicate content of buffer in git folder

Linux Mint 20 Emacs 27.2 In my init.el I has: '(auto-revert-tail-mode t t) And as result when I open file that in git repository (in folder with .git folder) then content of file is duplicate. When ...
0
votes
0answers
30 views

Remove stale buffers after switching to a different branch

This is the scenario: Switch to a new git branch Open some "new files" in that branch Switch back to an older branch that doesn't have these "new files" I want these opened ...
2
votes
1answer
69 views

magit equivalent to `git push -u origin newLocalBranch`

I often create new branches locally (e.g., newLocalBranch), and then push them to the upstream remote origin, thus creating a new remote branch, using git push -u origin newLocalBranch. Is there a ...
3
votes
1answer
59 views

Magit status section with recent checkouts / visited branches?

In the same fashion magit can offer the list of recent commits in a section of status buffer. I'd like to have a list of recent checkout/visited branches to be able to quickly switch to it (M-xbb). ...
0
votes
0answers
51 views

How to take line from recent commit with Magit

Use Magit to view the log with show diffs (-p). Inspect 4 commit old commit. Navigate to a few lines I've since deleted, but want back my project. I can mark the lines but cannot copy them, which ...
0
votes
0answers
23 views

Smerge: clearer refine mode?

I'm using doom+magit to deal with git, and I have smerge configured to change in-file conflicts. When I enable the smerge refine mode to highligh changes on a per-word basis, I find that refines works ...
0
votes
0answers
23 views

Smerge: auto-resolve LaTeX-like git conflicts

I'm using doom emacs + magit, and it enables smerge for me to display nicely my conflicts. I just saw that smerge has a function smerge-resolve to automatically resolve conflicts. I'd like to use it ...
0
votes
0answers
45 views

How to git stage a just-tangled file in `org-babel-post-tangle-hook`

I want to create a org-babel-post-tangle-hook that does a git stage buffer-file-name. There is a boring technical issue I have, which is that I don't know how to call magit-stage-file from elisp so ...
0
votes
1answer
39 views

Pull from git before applying org-capture?

I'm using org-capture to take project-specific notes by having a notes file in each of several git repositories. Looking forward, however, I can see danger here: if I'm working on project (1) and I ...
0
votes
1answer
48 views

Magit: rebase and push, basic questions

I was learning magit and found this screenshot at Command to visit Github pull request of current branch with Magit: I was wondering why we have Rebase and Push (and not just Push) at the top. What ...
1
vote
1answer
392 views

What means Unmerged into origin/master in magit?

In the magit buffer I see Unmerged into origin/master, yet I'm not noticing see any issues while merging with magit or with git on the commandline. Searching for the the subject brought me here[0], ...
0
votes
1answer
56 views

Why magit use rectangle on origin/master and not only on master?

I have done a branch checkout on master but magit rectangle is on origin/master and not only on master.
1
vote
0answers
196 views

emacs27 : Depends: emacs27-common but it is not going to be installed

I has Emacs 25.3 emacs -version GNU Emacs 25.3.2 Copyright (C) 2017 Free Software Foundation, Inc. GNU Emacs comes with ABSOLUTELY NO WARRANTY. You may redistribute copies of GNU Emacs under the terms ...
1
vote
0answers
26 views

Ignore file- and directory-variables when using "emacs -Q"?

I am using emacs -Q as editor for git, because my startup is too heavy for "quick editing" use and using emacsclient will hang when git is invoked with M-x shell-command. However, as a ...
0
votes
1answer
47 views

Can Emacs be set to auto-stage (preferably with --intent-to-add) new files?

I often add a new file to a repo, make some other changes, then stage all, and commit all, forgetting that the new file is not yet tracked, so is not included in the stage all step. At least one ...
1
vote
1answer
62 views

How to apply a hunk of changes in diff to current branch?

I have two branches, let's say branch a and b, I would like to apply some changes from b to a. Note that I use magit-diff to show the differences between the two branches. Then I would like to apply ...
0
votes
0answers
23 views

vc-annotate: strip the last character of git commit id

When editing a file managed by Git, vc-annotate shows the output of git blame. As Git usually does, revisions are identified by a short commit id. The short commit id is abbreviated to be one ...
0
votes
1answer
23 views

Lags when navigating vc-root-diff buffer

When I move around the buffer *vc-diff* from vc-root-diff I experience lags. GNU Emacs 27.1 (build 1, x86_64-pc-cygwin) of 2020-10-29. With procmon I detected lots of: C:\opt\cygwin64\bin\git.exe --no-...
0
votes
1answer
138 views

Magit git commit isn't working on spacemacs

After installing Magit in spacemacs. I used Helm to create a git repository. I added some files to stage then tried to commit. Let me know if I'm doing something wrong or it's just an issue. I get: ...
1
vote
1answer
91 views

Git commit multiple files

When I go to commit my changes VC seems only allows me to commit one file at a time via C-x v v. Is there a way for VC to commit more than 1 file at a time?
0
votes
1answer
158 views

Syntax highlighting for comments in Magit commit buffers with custom core.commentChar

I frequently source the body of my GitHub PRs from my commits, and thus is makes sense to consider my commits to be made in Markdown (it is nice to have a markup language for commits anyway). Thus I ...
0
votes
1answer
62 views

Git Repo for Doom Config With Different Platforms

I have emacs on two separate platforms, and I would like it to function in much the same way on both, but there is some platform-dependent configuration as well. I have created a git repository in my ....
1
vote
0answers
117 views

Cannot figure out why vc-git.elc is always loaded on startup

This is more a curiosity, than a necessity. I'm playing around with startup times, and to have something to compare with, I wanted to see how fast emacs could start up pure. Running emacs -Q, emacs-...
2
votes
1answer
217 views

Cannot edit ".gitignore" due to strange errors and read-only switched on

A new error has occurred with a recent upgrade to Emacs 27.1. I'm trying to edit .gitignore and get the following error: *ERROR*: Unlocking file: Invalid argument, <directory>/.gitignore To ...
2
votes
2answers
180 views

Magit remove local branches that were merged into another branch

Explaining the problem more in-depth than the titular definition: Often I merge branches into master and want to prune based on that. M-p works fantastic for removing the remote branches (eg origin/...
0
votes
1answer
102 views

Cannot paste text copied from Emacs to synchronous subprocess

TL;DR When trying to paste text copied/killed in Emacs to another program while Emacs is waiting for a synchronous subprocess to finish, the target program hangs until Emacs becomes responsive again. ...
0
votes
1answer
74 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 ...
0
votes
2answers
117 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:...
1
vote
1answer
115 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\\'...
0
votes
1answer
60 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
67 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
87 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 ...

1
2 3 4 5