]> git.ipfire.org Git - thirdparty/git.git/blame - Documentation/git-replace.txt
send-email: file_declares_8bit_cte doesn't need a prototype
[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-----------
17Adds a 'replace' reference in `.git/refs/replace/`
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
ddae8ae8 23Unless `-f` is given, the 'replace' reference must not yet exist in
0f3a5bfd
CC
24`.git/refs/replace/` directory.
25
ddae8ae8
CC
26Replacement references will be used by default by all git commands
27except those doing reachability traversal (prune, pack transfer and
28fsck).
b0fa7ab5 29
ddae8ae8
CC
30It is possible to disable use of replacement references for any
31command using the `--no-replace-objects` option just after 'git'.
b0fa7ab5 32
ddae8ae8 33For example if commit 'foo' has been replaced by commit 'bar':
b0fa7ab5
CC
34
35------------------------------------------------
ddae8ae8 36$ git --no-replace-objects cat-file commit foo
b0fa7ab5
CC
37------------------------------------------------
38
ddae8ae8 39shows information about commit 'foo', while:
b0fa7ab5
CC
40
41------------------------------------------------
42$ git cat-file commit foo
43------------------------------------------------
44
ddae8ae8 45shows information about commit 'bar'.
b0fa7ab5 46
0de8b947
CC
47The 'GIT_NO_REPLACE_OBJECTS' environment variable can be set to
48achieve the same effect as the `--no-replace-objects` option.
49
0f3a5bfd
CC
50OPTIONS
51-------
52-f::
53 If an existing replace ref for the same object exists, it will
54 be overwritten (instead of failing).
55
56-d::
57 Delete existing replace refs for the given objects.
58
59-l <pattern>::
60 List replace refs for objects that match the given pattern (or
61 all if no pattern is given).
62 Typing "git replace" without arguments, also lists all replace
63 refs.
64
65BUGS
66----
67Comparing blobs or trees that have been replaced with those that
ca768288 68replace them will not work properly. And using `git reset --hard` to
0f3a5bfd
CC
69go back to a replaced commit will move the branch to the replacement
70commit instead of the replaced commit.
71
72There may be other problems when using 'git rev-list' related to
73pending objects. And of course things may break if an object of one
74type is replaced by an object of another type (for example a blob
75replaced by a commit).
76
77SEE ALSO
78--------
79linkgit:git-tag[1]
80linkgit:git-branch[1]
b0fa7ab5 81linkgit:git[1]
0f3a5bfd
CC
82
83Author
84------
85Written by Christian Couder <chriscool@tuxfamily.org> and Junio C
86Hamano <gitster@pobox.com>, based on 'git tag' by Kristian Hogsberg
87<krh@redhat.com> and Carlos Rica <jasampler@gmail.com>.
88
89Documentation
90--------------
91Documentation by Christian Couder <chriscool@tuxfamily.org> and the
92git-list <git@vger.kernel.org>, based on 'git tag' documentation.
93
94GIT
95---
96Part of the linkgit:git[1] suite