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
2 votes
1 answer
37 views

How to force a git checkout revision in Magit if there are unstaged changes?

On the terminal, in a repository with unstaged changes, I can do: ~/projects/introduction-to-clojure$ git checkout -f 3.7 Branch '3.7' set up to track remote branch '3.7' from 'origin'. Switched to a ...
user avatar
0 votes
1 answer
16 views

Which option should I choose when executing "i' (Ignore) on Magit? Should Gitignore be shared in private, at the top level or in subdirectory?

I keep my emacs init file under version control. See the GitHub. I have the things installed from ELPA also unver version control. Which is annoying. After executing Magit status, I have: Head: ...
user avatar
1 vote
1 answer
56 views

Make Magit ignore certain files already added to git and to .gitignore

This question is related to this previous question. These two files below are under version control which causes some inconvenience in magit-status: Unstaged changes (2) modified .emacs.d/projectile-...
user avatar
2 votes
1 answer
61 views

How to properly use Magit Fixup?

I am trying to use the Fixup feature on Magit. I will list a recipe to what it is happening: (i) - I have a project under version control. (ii) - My first commit is: 1f61d09 * first commit: add file ...
user avatar
0 votes
1 answer
19 views

Insert a string to the git-commit message buffer

I have configured git to use emacs as editor for writing commit messages (with (start-server) in my init.el). I now want to put a template message (e.g. Bug #1234:) on top of the commit message buffer ...
user avatar
  • 103
1 vote
0 answers
35 views

Magit ediff range in a pretty way?

I need to investigate a project, with a patch made by a former student of my university. He made a series of commits on a repo, and I need to see what additions he made. I got the list of files ...
user avatar
0 votes
1 answer
30 views

In Magit, what is the difference between stashing "index", "worktree", or "both"?

Honestly, I have always picked both and it has worked out so far. But I do not know in which concrete cases it would be better to pick one over the other. It would be good to see examples. I tried ...
user avatar
1 vote
1 answer
45 views

How is the history.el file written? Why did this change happen?

I have been tweaking my config file (init.el). This file is inside a .emacs.d directory which is under version control by Git. I also use Magit a lot. After editing my config, I was going to stage, ...
user avatar
2 votes
1 answer
45 views

Is it possible to do a git clone using Magit in a directory which is not under version control?

Suppose I am in a folder called local-projects. Using the terminal, I can do: [pedro@system:~/quicklisp/local-projects]$ pwd /home/pedro/quicklisp/local-projects An important information to ...
user avatar
0 votes
0 answers
49 views

How to make `git fetch` `git rebase origin/master` work in Magit?

I have a branch that I have been working on. At the same time, master branch was evolving. I decided to put my local branch changes on top of master new changes. Thus, after pulling changes on master, ...
user avatar
1 vote
2 answers
61 views

How to git reset --hard HEAD~1 in Magit?

I accidentally inserted 1 commit in my local master branch. I have not pushed this changed and I want to remove it. This was supposed to be in a new branch. So, I created a new branch based on master ...
user avatar
1 vote
0 answers
36 views

How to set git-gutter's default encoding

Every time I visit a buffer containing characters such as 'ç' 'á' 'ã' or 'é', emacs throws out this error: These default coding systems were tried to encode text in the buffer ‘ *temp file*’: (utf-8-...
user avatar
  • 106
1 vote
1 answer
39 views

How can I disable ***all*** VC/git awareness?

Even when I start Emacs without any initialization file, it is still aware of version control. (For example, if I visit a git-controlled file, the modeline will say something like "Git:some-...
user avatar
  • 2,909
1 vote
1 answer
27 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-...
user avatar
  • 1,066
0 votes
3 answers
145 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 ...
user avatar
  • 1,066
2 votes
2 answers
48 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 ...
user avatar
1 vote
0 answers
41 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) ...
user avatar
2 votes
0 answers
200 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 --...
user avatar
  • 1,066
1 vote
0 answers
125 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)....
user avatar
  • 1,066
0 votes
1 answer
72 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 ...
user avatar
1 vote
1 answer
40 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/....
user avatar
1 vote
1 answer
23 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/....
user avatar
3 votes
1 answer
293 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 ...
user avatar
1 vote
1 answer
94 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 ...
user avatar
  • 3,885
0 votes
1 answer
101 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?
user avatar
1 vote
1 answer
103 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 ...
user avatar
0 votes
2 answers
105 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 ...
user avatar
  • 1,668
12 votes
1 answer
369 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()) { ...
user avatar
  • 1,481
2 votes
0 answers
32 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.
user avatar
  • 620
2 votes
0 answers
70 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 ...
user avatar
0 votes
0 answers
35 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 ...
user avatar
  • 554
2 votes
1 answer
80 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 ...
user avatar
  • 160
3 votes
1 answer
71 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). ...
user avatar
0 votes
0 answers
86 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 ...
user avatar
0 votes
0 answers
54 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 ...
user avatar
0 votes
1 answer
46 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 ...
user avatar
0 votes
1 answer
67 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 ...
user avatar
1 vote
1 answer
711 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], ...
user avatar
  • 607
0 votes
1 answer
64 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.
user avatar
1 vote
0 answers
265 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 ...
user avatar
  • 3,435
1 vote
0 answers
30 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 ...
user avatar
  • 1,481
0 votes
1 answer
55 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 ...
user avatar
1 vote
1 answer
96 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 ...
user avatar
0 votes
0 answers
31 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 ...
user avatar
0 votes
1 answer
24 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-...
user avatar
  • 3,132
0 votes
1 answer
170 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: ...
user avatar
1 vote
1 answer
144 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?
user avatar
  • 13
0 votes
1 answer
174 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 ...
user avatar
0 votes
1 answer
94 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 ....
user avatar
1 vote
0 answers
132 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-...
user avatar
  • 131

1
2 3 4 5