]>
Commit | Line | Data |
---|---|---|
1 | git-replace(1) | |
2 | ============== | |
3 | ||
4 | NAME | |
5 | ---- | |
6 | git-replace - Create, list, delete refs to replace objects | |
7 | ||
8 | SYNOPSIS | |
9 | -------- | |
10 | [verse] | |
11 | 'git replace' [-f] <object> <replacement> | |
12 | 'git replace' -d <object>... | |
13 | 'git replace' -l [<pattern>] | |
14 | ||
15 | DESCRIPTION | |
16 | ----------- | |
17 | Adds a 'replace' reference in `refs/replace/` namespace. | |
18 | ||
19 | The name of the 'replace' reference is the SHA1 of the object that is | |
20 | replaced. The content of the 'replace' reference is the SHA1 of the | |
21 | replacement object. | |
22 | ||
23 | Unless `-f` is given, the 'replace' reference must not yet exist. | |
24 | ||
25 | Replacement references will be used by default by all Git commands | |
26 | except those doing reachability traversal (prune, pack transfer and | |
27 | fsck). | |
28 | ||
29 | It is possible to disable use of replacement references for any | |
30 | command using the `--no-replace-objects` option just after 'git'. | |
31 | ||
32 | For example if commit 'foo' has been replaced by commit 'bar': | |
33 | ||
34 | ------------------------------------------------ | |
35 | $ git --no-replace-objects cat-file commit foo | |
36 | ------------------------------------------------ | |
37 | ||
38 | shows information about commit 'foo', while: | |
39 | ||
40 | ------------------------------------------------ | |
41 | $ git cat-file commit foo | |
42 | ------------------------------------------------ | |
43 | ||
44 | shows information about commit 'bar'. | |
45 | ||
46 | The 'GIT_NO_REPLACE_OBJECTS' environment variable can be set to | |
47 | achieve the same effect as the `--no-replace-objects` option. | |
48 | ||
49 | OPTIONS | |
50 | ------- | |
51 | -f:: | |
52 | If an existing replace ref for the same object exists, it will | |
53 | be overwritten (instead of failing). | |
54 | ||
55 | -d:: | |
56 | Delete existing replace refs for the given objects. | |
57 | ||
58 | -l <pattern>:: | |
59 | List replace refs for objects that match the given pattern (or | |
60 | all if no pattern is given). | |
61 | Typing "git replace" without arguments, also lists all replace | |
62 | refs. | |
63 | ||
64 | BUGS | |
65 | ---- | |
66 | Comparing blobs or trees that have been replaced with those that | |
67 | replace them will not work properly. And using `git reset --hard` to | |
68 | go back to a replaced commit will move the branch to the replacement | |
69 | commit instead of the replaced commit. | |
70 | ||
71 | There may be other problems when using 'git rev-list' related to | |
72 | pending objects. And of course things may break if an object of one | |
73 | type is replaced by an object of another type (for example a blob | |
74 | replaced by a commit). | |
75 | ||
76 | SEE ALSO | |
77 | -------- | |
78 | linkgit:git-tag[1] | |
79 | linkgit:git-branch[1] | |
80 | linkgit:git[1] | |
81 | ||
82 | GIT | |
83 | --- | |
84 | Part of the linkgit:git[1] suite |