summaryrefslogtreecommitdiffstats
path: root/software/git.page
blob: 418175d89bf0a2f94e6fed66332c5eeebd3578e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
format: rst
toc: no
...

=======================
Git
=======================

Quick tip: when you have ``.gitignore`` ignoring everything (with a ``*`` 
entry), you need to use ``git-update-index --add FILE`` to actually add the
file, instead of just ``git-add FILE``.

Over HTTP
--------------
To make a repository available over "dumb" HTTP, set up a bare repository and
copy ``hooks/post-update.sample`` to ``hooks/post-update``.

To add links from gitweb, add to the ``@git_base_url_list`` list in the
configuration file.

Copying Files Between Repositories with History
------------------------------------------------

Create a branch with only python files (slow; ignore the very verbose "won't
delete directory" output):

    git checkout -b filtered-commits
    git filter-branch -f --prune-empty --tree-filter 'find . -not -iname "*.py" -exec rm {} \;' filtered-commits

In the receiving repo:

    git pull path/to/source/repo

See also:

http://gbayer.com/development/moving-files-from-one-git-repository-to-another-preserving-history/
http://superuser.com/questions/164362/git-keep-changelog-for-file-when-moving-to-a-different-repository

Color
-------

    git config --global --add color.ui true

Change Author Email in Recent Commits
----------------------------------------

For the most recent commit, use:

    git commit --amend --author="First Last <user@example.com>"

To edit specific commits, use `rebase -i` and "edit" the commits you want to
change and use `--amend` as above for each.