@@ -42,10 +42,9 @@ How to get a git repository
42
42
It will be useful to have a git repository to experiment with as you
43
43
read this manual.
44
44
45
- The best way to get one is by using the gitlink:git-clone[1] command
46
- to download a copy of an existing repository for a project that you
47
- are interested in. If you don't already have a project in mind, here
48
- are some interesting examples:
45
+ The best way to get one is by using the gitlink:git-clone[1] command to
46
+ download a copy of an existing repository. If you don't already have a
47
+ project in mind, here are some interesting examples:
49
48
50
49
------------------------------------------------
51
50
# git itself (approx. 10MB download):
@@ -63,21 +62,18 @@ directory, you will see that it contains a copy of the project files,
63
62
together with a special top-level directory named ".git", which
64
63
contains all the information about the history of the project.
65
64
66
- In most of the following, examples will be taken from one of the two
67
- repositories above.
68
-
69
65
[[how-to-check-out]]
70
66
How to check out a different version of a project
71
67
-------------------------------------------------
72
68
73
- Git is best thought of as a tool for storing the history of a
74
- collection of files. It stores the history as a compressed
75
- collection of interrelated snapshots (versions) of the project's
76
- contents .
69
+ Git is best thought of as a tool for storing the history of a collection
70
+ of files. It stores the history as a compressed collection of
71
+ interrelated snapshots of the project's contents. In git each such
72
+ version is called a <<def_commit,commit>> .
77
73
78
74
A single git repository may contain multiple branches. It keeps track
79
75
of them by keeping a list of <<def_head,heads>> which reference the
80
- latest version on each branch; the gitlink:git-branch[1] command shows
76
+ latest commit on each branch; the gitlink:git-branch[1] command shows
81
77
you the list of branch heads:
82
78
83
79
------------------------------------------------
@@ -149,32 +145,27 @@ current branch:
149
145
150
146
------------------------------------------------
151
147
$ git show
152
- commit 2b5f6dcce5bf94b9b119e9ed8d537098ec61c3d2
153
- Author: Jamal Hadi Salim <
[email protected] >
154
- Date: Sat Dec 2 22:22:25 2006 -0800
155
-
156
- [XFRM]: Fix aevent structuring to be more complete.
157
-
158
- aevents can not uniquely identify an SA. We break the ABI with this
159
- patch, but consensus is that since it is not yet utilized by any
160
- (known) application then it is fine (better do it now than later).
161
-
162
- Signed-off-by: Jamal Hadi Salim <
[email protected] >
163
- Signed-off-by: David S. Miller <
[email protected] >
164
-
165
- diff --git a/Documentation/networking/xfrm_sync.txt b/Documentation/networking/xfrm_sync.txt
166
- index 8be626f..d7aac9d 100644
167
- --- a/Documentation/networking/xfrm_sync.txt
168
- +++ b/Documentation/networking/xfrm_sync.txt
169
- @@ -47,10 +47,13 @@ aevent_id structure looks like:
170
-
171
- struct xfrm_aevent_id {
172
- struct xfrm_usersa_id sa_id;
173
- + xfrm_address_t saddr;
174
- __u32 flags;
175
- + __u32 reqid;
176
- };
177
- ...
148
+ commit 17cf781661e6d38f737f15f53ab552f1e95960d7
149
+ Author: Linus Torvalds <
[email protected] .(none)>
150
+ Date: Tue Apr 19 14:11:06 2005 -0700
151
+
152
+ Remove duplicate getenv(DB_ENVIRONMENT) call
153
+
154
+ Noted by Tony Luck.
155
+
156
+ diff --git a/init-db.c b/init-db.c
157
+ index 65898fa..b002dc6 100644
158
+ --- a/init-db.c
159
+ +++ b/init-db.c
160
+ @@ -7,7 +7,7 @@
161
+
162
+ int main(int argc, char **argv)
163
+ {
164
+ - char *sha1_dir = getenv(DB_ENVIRONMENT), *path;
165
+ + char *sha1_dir, *path;
166
+ int len, i;
167
+
168
+ if (mkdir(".git", 0755) < 0) {
178
169
------------------------------------------------
179
170
180
171
As you can see, a commit shows who made the latest change, what they
@@ -923,7 +914,7 @@ they look OK.
923
914
924
915
[[Finding-comments-with-given-content]]
925
916
Finding commits referencing a file with given content
926
- -----------------------------------------------------
917
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
927
918
928
919
Somebody hands you a copy of a file, and asks which commits modified a
929
920
file such that it contained the given content either before or after the
@@ -1105,20 +1096,14 @@ backup files made by your editor. Of course, 'not' tracking files with git
1105
1096
is just a matter of 'not' calling "`git add`" on them. But it quickly becomes
1106
1097
annoying to have these untracked files lying around; e.g. they make
1107
1098
"`git add .`" and "`git commit -a`" practically useless, and they keep
1108
- showing up in the output of "`git status`", etc .
1099
+ showing up in the output of "`git status`".
1109
1100
1110
- Git therefore provides "exclude patterns" for telling git which files to
1111
- actively ignore. Exclude patterns are thoroughly explained in the
1112
- gitlink:gitignore[5] manual page, but the heart of the concept is simply
1113
- a list of files which git should ignore. Entries in the list may contain
1114
- globs to specify multiple files, or may be prefixed by "`!`" to
1115
- explicitly include (un-ignore) a previously excluded (ignored) file
1116
- (i.e. later exclude patterns override earlier ones). The following
1117
- example should illustrate such patterns:
1101
+ You can tell git to ignore certain files by creating a file called .gitignore
1102
+ in the top level of your working directory, with contents such as:
1118
1103
1119
1104
-------------------------------------------------
1120
1105
# Lines starting with '#' are considered comments.
1121
- # Ignore foo.txt.
1106
+ # Ignore any file named foo.txt.
1122
1107
foo.txt
1123
1108
# Ignore (generated) html files,
1124
1109
*.html
@@ -1128,41 +1113,20 @@ foo.txt
1128
1113
*.[oa]
1129
1114
-------------------------------------------------
1130
1115
1131
- The next question is where to put these exclude patterns so that git can
1132
- find them. Git looks for exclude patterns in the following files:
1133
-
1134
- `.gitignore` files in your working tree:::
1135
- You may store multiple `.gitignore` files at various locations in your
1136
- working tree. Each `.gitignore` file is applied to the directory where
1137
- it's located, including its subdirectories. Furthermore, the
1138
- `.gitignore` files can be tracked like any other files in your working
1139
- tree; just do a "`git add .gitignore`" and commit. `.gitignore` is
1140
- therefore the right place to put exclude patterns that are meant to
1141
- be shared between all project participants, such as build output files
1142
- (e.g. `\*.o`), etc.
1143
- `.git/info/exclude` in your repo:::
1144
- Exclude patterns in this file are applied to the working tree as a
1145
- whole. Since the file is not located in your working tree, it does
1146
- not follow push/pull/clone like `.gitignore` can do. This is therefore
1147
- the place to put exclude patterns that are local to your copy of the
1148
- repo (i.e. 'not' shared between project participants), such as
1149
- temporary backup files made by your editor (e.g. `\*~`), etc.
1150
- The file specified by the `core.excludesfile` config directive:::
1151
- By setting the `core.excludesfile` config directive you can tell git
1152
- where to find more exclude patterns (see gitlink:git-config[1] for
1153
- more information on configuration options). This config directive
1154
- can be set in the per-repo `.git/config` file, in which case the
1155
- exclude patterns will apply to that repo only. Alternatively, you
1156
- can set the directive in the global `~/.gitconfig` file to apply
1157
- the exclude pattern to all your git repos. As with the above
1158
- `.git/info/exclude` (and, indeed, with git config directives in
1159
- general), this directive does not follow push/pull/clone, but remain
1160
- local to your repo(s).
1161
-
1162
- [NOTE]
1163
- In addition to the above alternatives, there are git commands that can take
1164
- exclude patterns directly on the command line. See gitlink:git-ls-files[1]
1165
- for an example of this.
1116
+ See gitlink:gitignore[5] for a detailed explanation of the syntax. You can
1117
+ also place .gitignore files in other directories in your working tree, and they
1118
+ will apply to those directories and their subdirectories. The `.gitignore`
1119
+ files can be added to your repository like any other files (just run `git add
1120
+ .gitignore` and `git commit`, as usual), which is convenient when the exclude
1121
+ patterns (such as patterns matching build output files) would also make sense
1122
+ for other users who clone your repository.
1123
+
1124
+ If you wish the exclude patterns to affect only certain repositories
1125
+ (instead of every repository for a given project), you may instead put
1126
+ them in a file in your repository named .git/info/exclude, or in any file
1127
+ specified by the `core.excludesfile` configuration variable. Some git
1128
+ commands can also take exclude patterns directly on the command line.
1129
+ See gitlink:gitignore[5] for the details.
1166
1130
1167
1131
[[how-to-merge]]
1168
1132
How to merge
@@ -1796,11 +1760,12 @@ taken from the message containing each patch.
1796
1760
Public git repositories
1797
1761
-----------------------
1798
1762
1799
- Another way to submit changes to a project is to tell the maintainer of
1800
- that project to pull the changes from your repository using git-pull[1].
1801
- In the section "<<getting-updates-with-git-pull, Getting updates with
1802
- git pull>>" we described this as a way to get updates from the "main"
1803
- repository, but it works just as well in the other direction.
1763
+ Another way to submit changes to a project is to tell the maintainer
1764
+ of that project to pull the changes from your repository using
1765
+ gitlink:git-pull[1]. In the section "<<getting-updates-with-git-pull,
1766
+ Getting updates with git pull>>" we described this as a way to get
1767
+ updates from the "main" repository, but it works just as well in the
1768
+ other direction.
1804
1769
1805
1770
If you and the maintainer both have accounts on the same machine, then
1806
1771
you can just pull changes from each other's repositories directly;
@@ -2057,7 +2022,8 @@ $ cd work
2057
2022
Linus's tree will be stored in the remote branch named origin/master,
2058
2023
and can be updated using gitlink:git-fetch[1]; you can track other
2059
2024
public trees using gitlink:git-remote[1] to set up a "remote" and
2060
- git-fetch[1] to keep them up-to-date; see <<repositories-and-branches>>.
2025
+ gitlink:git-fetch[1] to keep them up-to-date; see
2026
+ <<repositories-and-branches>>.
2061
2027
2062
2028
Now create the branches in which you are going to work; these start out
2063
2029
at the current tip of origin/master branch, and should be set up (using
@@ -2512,9 +2478,9 @@ $ gitk origin..mywork &
2512
2478
And browse through the list of patches in the mywork branch using gitk,
2513
2479
applying them (possibly in a different order) to mywork-new using
2514
2480
cherry-pick, and possibly modifying them as you go using commit --amend.
2515
- The git-gui[1] command may also help as it allows you to individually
2516
- select diff hunks for inclusion in the index (by right-clicking on the
2517
- diff hunk and choosing "Stage Hunk for Commit").
2481
+ The gitlink: git-gui[1] command may also help as it allows you to
2482
+ individually select diff hunks for inclusion in the index (by
2483
+ right-clicking on the diff hunk and choosing "Stage Hunk for Commit").
2518
2484
2519
2485
Another technique is to use git-format-patch to create a series of
2520
2486
patches, then reset the state to before the patches:
0 commit comments