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
1answer
139 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 ...
5
votes
2answers
536 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>...
0
votes
2answers
179 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?
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 ...
4
votes
1answer
1k 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
191 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-...
1
vote
1answer
369 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 ...
53
votes
4answers
12k views

Change a branch's upstream with Magit

When you push a branch with Magit (with P P) and the branch has no upstream, Magit asks you the name of the branch you want to push to. That's great. Once you set the upstream for a branch, however, ...
3
votes
1answer
4k 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
173 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
75 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
27 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 ...
4
votes
1answer
959 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
575 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 ...
1
vote
1answer
386 views

Git bash opens in window outside of emacs

When running Emacs on Windows 10, I am able to launch git bash from within Emacs using the information given here, here, or here. For example, I can just add these two lines to my .emacs: (setq ...
3
votes
1answer
401 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/....
1
vote
1answer
187 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 ...
1
vote
2answers
99 views

magit: The work for five tasks are mixed in my working directory

So during a hectic coding session, I forgot to do git commit as I did baby steps. Now I have fifty changes in my working directory. And these changes are related to five separate tasks. So I would ...
0
votes
1answer
208 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
254 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
509 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.
5
votes
1answer
508 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
117 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
150 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
86 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 ...
2
votes
1answer
285 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?
2
votes
2answers
251 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 ...
1
vote
1answer
293 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
834 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
7k 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 ...
24
votes
1answer
3k views

Choose files to stage of a new directory with magit

If you create a new directory, its files won't show up with magit-status, only the new directory is in the list of Untracked items. Currently I have to magit-stage-item the new directory and then ...
0
votes
1answer
183 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
180 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 ...
1
vote
1answer
3k views

How to show git repo status info in mode-line

Here is my current custom, but I don't know how to customize its face. And it only shows branch name, no other status info. (setq-default mode-line-format (quote ((:eval (if vc-mode (...
3
votes
1answer
337 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
930 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-...
2
votes
2answers
962 views

Magit - Unable to commit

Magit is unable to commit anything is giving the following message 1 c:/cygwin64/bin/git.exe … commit -- Waiting for Emacs... ERROR: Wrong type argument: arrayp, nilerror: There was a problem ...
5
votes
3answers
288 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
2answers
971 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 ...
0
votes
1answer
64 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...
3
votes
1answer
690 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&...
53
votes
4answers
11k 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 ...
1
vote
1answer
174 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 ...
3
votes
2answers
664 views

How to change options passed to git vc-annotate?

I have a hard time using vc-annotate (my version control system is git), because the output is not very userfriendly, as it displays long filenames in a separate column in the buffer, which take up ...
3
votes
1answer
120 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
127 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 ...
3
votes
4answers
482 views

Predicate function to test if file is under version control?

What is the predicate function to determine if a given file is under version control? (I'm using git.)
14
votes
2answers
1k views

Git: is it possible to stage a selected region directly from the file buffer?

With Magit you can open the magit status buffer, press TAB to expand the diff (or RET to bring up a separate diff buffer), mark parts of a hunk and press s or u to stage/unstage the region. Really ...
5
votes
3answers
1k views

Magit always use current branch to create new branch

I am currently on master branch and I have to create new branch called test starting from master. If I run b c in magit buffer, magit will prompt for starting point Create branch starting at (...
2
votes
1answer
124 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?