aboutsummaryrefslogtreecommitdiff
path: root/doc/forum/How_to_get_git-annex_to_forget_a_commit__63__.mdwn
blob: d5aa71b448f39fd17a2410c81308779be4221f2c (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
54
I've done a `git annex add` and `git commit` on my annex which included some files I don't want to add to the annex. I've tried to reverse it all out, but whenever I `git annex add` something, the unwanted files show up in the git-annex branch.

    git init forgetmenot
    cd forgetmenot
    git commit -m "create" --allow-empty
    git annex init fmn
    
    echo 'foo' > foo
    echo 'bar' > bar
    
    git annex add
    git commit -m "add foo"
    
    git log --oneline --name-only
    # 28634c0 add foo
    # bar
    # foo
    # 4a87050 create

    git log --oneline --name-only git-annex
    74e6969 update
    41d/a26/SHA256E-s4--b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c.log
    a70/4a5/SHA256E-s4--7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730.log
    95285ed update
    uuid.log
    2135e07 branch created

If you now try to get git-annex to forget by reverting *master* and *git-annex* and only adding/commiting *foo*, the master branch ends up correct, but git-annex magically remembers *bar*!

    git reset --hard HEAD^
    git branch -f git-annex git-annex^

    echo 'foo' > foo
    git annex add
    git commit -m "add foo"

    git log --oneline --name-only
    # 1b4889e add foo
    # foo
    # 4a87050 create

    git log --oneline --name-only git-annex
    # 3d0b9bc update
    # 41d/a26/SHA256E-s4--b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c.log
    # a70/4a5/SHA256E-s4--7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730.log
    # 2e17a19 update
    # uuid.log
    # 646776b branch created

How is git-annex remembering this and how can I get it to completely forget?

I have tried `git gc --aggressive --prune=all`, `git annex fsck --all` and `git annex drop unused` but somehow, git-annex is remembering bar existed.

This is an exercise in micro-managing the git-annex branch a bit, but this situation does also cause git-annex to complain about the missing files on fsck (0 out of 2 copies) so it isn't just being a control freak! Honest! :)