Git
Last substantive revision: 2016-12-29
I use Git to version-control my writings and software.
I tend to use Git both on the command-line as well as in Vim using fugitive.vim and gv.vim. I also tend to look through commits and other information on GitHub (:Gbrowse
makes it easy to go directly from Vim to the listing on GitHub).
For my Git configuration, see my .gitconfig
and .gitignore_global
.
Some useful commands
View all unadded files, including ones in
.gitignore
.git add -Anf
-A
: all;-n
: dry run;-f
: force files in.gitignore
.See this question.
Dealing with submodules
git submodule update --init git submodule foreach git pull origin master
Check when the last revision date for a page on this site was last modified:
git blame -L '/date: /,+1' wiki/PAGENAME.md
Weird behavior
I’m documenting some weird behavior I’ve observed.
In ~/.gitconfig
:
[core]
pager = less -+S -r
Then running git diff --color 3cc00f112bf~1 3cc00f112bf
in the CP Wiki repo. This causes colors to show up, but the header doesn’t show up at first. If you hit G
to go to the bottom, then hit g
to get back up, you can see the header. You can do some pretty weird things with this, e.g. git diff --color 3cc00f112bf~1 3cc00f112bf | fold | less -r
will make the color fade out in some regions, and you can also see strange character marks.
See also
- Software for more about the software I use