magit

Using emacs (and magit?) to visit a file in given commit/branch/etc

╄→гoц情女王★ 提交于 2019-12-02 16:41:10
If I want to see how foo.bar looked like in some certain commit <COMMIT_ID> then I can invoke: git show <COMMIT_ID>:foo.bar Nice... How can I do it in emacs ? Using magit ? Using vc ? Say I am visiting the file foo.bar and I want to look up how it looked in <COMMIT_ID> . The canonical way to do that in Emacs is to use VC: C-x v ~ from the file's buffer will ask you for a revision and then show that file as it was at that revision. It should work for any control system supported by VC, such as Git, Bzr, ... C-x v l to view the file's history. n and p to move between commits. f to visit the file

View a file's history in Magit?

半世苍凉 提交于 2019-12-02 14:48:08
View the change history of a file using Git versioning talks about other ways of viewing history of a file in Git. Can it be done in Emacs Magit? Ragge Since magit 2.1: magit-log-buffer-file (as per comment below) Before magit 2.1: magit-file-log is what you are looking for. It will show you all commits for the file in the current buffer in the standard magit log view. Open your magit-status buffer, by typing M-x magit-status (I used to have this bound to C-. C-g because it is used all the time. These days, I use Spacemacs so it's <SPC> g s ) Type l to get log viewing option Type =f to set the

Accidental commit; how to not push an unpushed commit in Magit Emacs

送分小仙女□ 提交于 2019-12-02 12:48:36
I did an accidental commit which really makes no sense to have anywhere in history. How can I remove this commit from existence (especially I don't want it appear remotely). In the magit-status, it shows: Unpushed commits: fe73b07 updated gitignore 974e70d test ab333e6 trying to go with a flat structure What can I do? Bonus: actually, I just want to keep the "updated gitignore" from this commit. Point at test, press E to start a rebase. M-n two swap commits. C-c C-c to finalize. Resolve merge conflicts if any and done. This is more a git question than an emacs or magit question really. If I

Emacs / Magit — how to create and delete repositories on Github

寵の児 提交于 2019-12-01 22:01:26
I am having trouble in Magit with step number 5 and step number 7 to create a new repository. If they exist, what are the interactive function equivalents (please) for steps 5 and 7? If there are no interactive equivalents, I guess I will need to write my own shell command functions -- unless, of course, someone would like to take a stab at them first. :) CREATE -- COMMAND-LINE RECIPE 1. $ touch README.md 2. $ /usr/local/git/bin/git init 3. $ /usr/local/git/bin/git add . 4. $ /usr/local/git/bin/git commit -m "First commit." 5. $ curl -u 'USERNAME' https://api.github.com/user/repos -d '{"name":

Emacs — How to push a Git repository to multiple remotes

守給你的承諾、 提交于 2019-11-29 10:38:46
I'm looking for some assistance, please, using Emacs / Magit to push the local repository changes to the remote website and to Github in one fell-swoop. I found a non-Emacs / non-Magit related thread ( https://stackoverflow.com/a/3195446/2112489 ) , with comments stating that it is the definitive answer on pushing to a remote and to Github, and it has a few hundred thumbs-up. I assume (perhaps incorrectly) that is a good starting point for the local .gitconfig file in the $HOME directory on my computer. [remote "GitHub"] url = git@github.com:elliottcable/Paws.o.git fetch = +refs/heads/*:refs

Splitting a hunk with magit

*爱你&永不变心* 提交于 2019-11-28 15:56:39
I have 2 edits very close by (and therefore part of the same hunk), that I'd like to commit separately. Is it possible to split a hunk from within magit? Dominik Honnef You can set the mark correctly with Ctrl+Space (C-SPC) and magit will only commit the selected portion. You can also use - and + to decrease or increase the extent of the hunks in the diff (and 0 resets), but dominikh's answer is the most important one to know about. Magit reuse diff-mode but don't expose many of diff-mode commands in its magit-revision-mode as this does VC package. For example you can call diff-split-hunk

Emacs — How to push a Git repository to multiple remotes

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 03:52:02
问题 I'm looking for some assistance, please, using Emacs / Magit to push the local repository changes to the remote website and to Github in one fell-swoop. I found a non-Emacs / non-Magit related thread ( https://stackoverflow.com/a/3195446/2112489) , with comments stating that it is the definitive answer on pushing to a remote and to Github, and it has a few hundred thumbs-up. I assume (perhaps incorrectly) that is a good starting point for the local .gitconfig file in the $HOME directory on my

Splitting a hunk with magit

妖精的绣舞 提交于 2019-11-27 19:51:46
问题 I have 2 edits very close by (and therefore part of the same hunk), that I'd like to commit separately. Is it possible to split a hunk from within magit? 回答1: You can set the mark correctly with Ctrl+Space (C-SPC) and magit will only commit the selected portion. 回答2: You can also use - and + to decrease or increase the extent of the hunks in the diff (and 0 resets), but dominikh's answer is the most important one to know about. 回答3: Magit reuse diff-mode but don't expose many of diff-mode