]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-replace.txt
user-manual: use -o latest.tar.gz to create a gzipped tarball
[thirdparty/git.git] / Documentation / git-replace.txt
CommitLineData
0f3a5bfd
CC
1git-replace(1)
2==============
3
4NAME
5----
6git-replace - Create, list, delete refs to replace objects
7
8SYNOPSIS
9--------
10[verse]
11'git replace' [-f] <object> <replacement>
12'git replace' -d <object>...
13'git replace' -l [<pattern>]
14
15DESCRIPTION
16-----------
831e61f8 17Adds a 'replace' reference in `refs/replace/` namespace.
0f3a5bfd
CC
18
19The name of the 'replace' reference is the SHA1 of the object that is
ddae8ae8 20replaced. The content of the 'replace' reference is the SHA1 of the
0f3a5bfd
CC
21replacement object.
22
831e61f8 23Unless `-f` is given, the 'replace' reference must not yet exist.
0f3a5bfd 24
ddae8ae8
CC
25Replacement references will be used by default by all git commands
26except those doing reachability traversal (prune, pack transfer and
27fsck).
b0fa7ab5 28
ddae8ae8
CC
29It is possible to disable use of replacement references for any
30command using the `--no-replace-objects` option just after 'git'.
b0fa7ab5 31
ddae8ae8 32For example if commit 'foo' has been replaced by commit 'bar':
b0fa7ab5
CC
33
34------------------------------------------------
ddae8ae8 35$ git --no-replace-objects cat-file commit foo
b0fa7ab5
CC
36------------------------------------------------
37
ddae8ae8 38shows information about commit 'foo', while:
b0fa7ab5
CC
39
40------------------------------------------------
41$ git cat-file commit foo
42------------------------------------------------
43
ddae8ae8 44shows information about commit 'bar'.
b0fa7ab5 45
0de8b947
CC
46The 'GIT_NO_REPLACE_OBJECTS' environment variable can be set to
47achieve the same effect as the `--no-replace-objects` option.
48
0f3a5bfd
CC
49OPTIONS
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
64BUGS
65----
66Comparing blobs or trees that have been replaced with those that
ca768288 67replace them will not work properly. And using `git reset --hard` to
0f3a5bfd
CC
68go back to a replaced commit will move the branch to the replacement
69commit instead of the replaced commit.
70
71There may be other problems when using 'git rev-list' related to
72pending objects. And of course things may break if an object of one
73type is replaced by an object of another type (for example a blob
74replaced by a commit).
75
76SEE ALSO
77--------
78linkgit:git-tag[1]
79linkgit:git-branch[1]
b0fa7ab5 80linkgit:git[1]
0f3a5bfd 81
0f3a5bfd
CC
82GIT
83---
84Part of the linkgit:git[1] suite