From e9b4908302c659251a47ce440676cb3b0d65b8af Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 17 Feb 2013 19:15:53 -0500 Subject: user-manual: use 'remote add' to setup push URLs There is no need to use here documents to setup this configuration. It is easier, less confusing, and more robust to use `git remote add` directly. Signed-off-by: W. Trevor King Signed-off-by: Junio C Hamano --- Documentation/user-manual.txt | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 4cb832526..74dd82ab7 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -1992,16 +1992,21 @@ will not be updated by the push. This may lead to unexpected results if the branch you push to is the currently checked-out branch! As with `git fetch`, you may also set up configuration options to -save typing; so, for example, after +save typing; so, for example: + +------------------------------------------------- +$ git remote add public-repo ssh://yourserver.com/~you/proj.git +------------------------------------------------- + +adds the following to `.git/config`: ------------------------------------------------- -$ cat >>.git/config < Date: Sun, 17 Feb 2013 19:15:55 -0500 Subject: user-manual: give 'git push -f' as an alternative to +master This mirrors existing language in the description of 'git fetch'. Signed-off-by: W. Trevor King Signed-off-by: Junio C Hamano --- Documentation/user-manual.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'Documentation') diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 74dd82ab7..a546b10ee 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -2045,6 +2045,13 @@ branch name with a plus sign: $ git push ssh://yourserver.com/~you/proj.git +master ------------------------------------------------- +Note the addition of the `+` sign. Alternatively, you can use the +`-f` flag to force the remote update, as in: + +------------------------------------------------- +$ git push -f ssh://yourserver.com/~you/proj.git master +------------------------------------------------- + Normally whenever a branch head in a public repository is modified, it is modified to point to a descendant of the commit that it pointed to before. By forcing a push in this situation, you break that convention. -- cgit v1.2.1 From 47adb8ac7c550bc89e7eae743dcc8940c2549edf Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 17 Feb 2013 19:15:56 -0500 Subject: user-manual: mention 'git remote add' for remote branch config I hardly ever setup remote..url using 'git config'. While it may be instructive to do so, we should also point out 'git remote add'. Signed-off-by: W. Trevor King Signed-off-by: Junio C Hamano --- Documentation/user-manual.txt | 40 +++++++++++++--------------------------- 1 file changed, 13 insertions(+), 27 deletions(-) (limited to 'Documentation') diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index a546b10ee..c28ba0dac 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -2856,48 +2856,34 @@ branch.master.merge=refs/heads/master If there are other repositories that you also use frequently, you can create similar configuration options to save typing; for example, -after ------------------------------------------------- -$ git config remote.example.url git://example.com/proj.git +$ git remote add example git://example.com/proj.git ------------------------------------------------- -then the following two commands will do the same thing: +adds the following to `.git/config`: ------------------------------------------------- -$ git fetch git://example.com/proj.git master:refs/remotes/example/master -$ git fetch example master:refs/remotes/example/master +[remote "example"] + url = git://example.com/proj.git + fetch = +refs/heads/*:refs/remotes/example/* ------------------------------------------------- -Even better, if you add one more option: - -------------------------------------------------- -$ git config remote.example.fetch master:refs/remotes/example/master -------------------------------------------------- +Also note that the above configuration can be performed by directly +editing the file `.git/config` instead of using linkgit:git-remote[1]. -then the following commands will all do the same thing: +After configuring the remote, the following three commands will do the +same thing: ------------------------------------------------- -$ git fetch git://example.com/proj.git master:refs/remotes/example/master -$ git fetch example master:refs/remotes/example/master +$ git fetch git://example.com/proj.git +refs/heads/*:refs/remotes/example/* +$ git fetch example +refs/heads/*:refs/remotes/example/* $ git fetch example ------------------------------------------------- -You can also add a "+" to force the update each time: - -------------------------------------------------- -$ git config remote.example.fetch +master:refs/remotes/example/master -------------------------------------------------- - -Don't do this unless you're sure you won't mind "git fetch" possibly -throwing away commits on 'example/master'. - -Also note that all of the above configuration can be performed by -directly editing the file .git/config instead of using -linkgit:git-config[1]. - See linkgit:git-config[1] for more details on the configuration -options mentioned above. +options mentioned above and linkgit:git-fetch[1] for more details on +the refspec syntax. [[git-concepts]] -- cgit v1.2.1 From 632cc3e6b687c48998223eb49fc465bcb3a9c1d2 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 17 Feb 2013 19:15:58 -0500 Subject: user-manual: use 'git config --global user.*' for setup A simple command line call is easier than spawning an editor, especially for folks new to ideas like the "command line" and "text editors". This is also the approach suggested by 'git commit' if you try and commit without having configured user.name or user.email. Signed-off-by: W. Trevor King Signed-off-by: Junio C Hamano --- Documentation/user-manual.txt | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'Documentation') diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index c28ba0dac..8074313f8 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -991,9 +991,16 @@ Developing with git Telling git your name --------------------- -Before creating any commits, you should introduce yourself to git. The -easiest way to do so is to make sure the following lines appear in a -file named .gitconfig in your home directory: +Before creating any commits, you should introduce yourself to Git. +The easiest way to do so is to use linkgit:git-config[1]: + +------------------------------------------------ +$ git config --global user.name 'Your Name Comes Here' +$ git config --global user.email 'you@yourdomain.example.com' +------------------------------------------------ + +Which will add the following to a file named `.gitconfig` in your +home directory: ------------------------------------------------ [user] @@ -1001,8 +1008,9 @@ file named .gitconfig in your home directory: email = you@yourdomain.example.com ------------------------------------------------ -(See the "CONFIGURATION FILE" section of linkgit:git-config[1] for -details on the configuration file.) +See the "CONFIGURATION FILE" section of linkgit:git-config[1] for +details on the configuration file. The file is plain text, so you can +also edit it with your favorite editor. [[creating-a-new-repository]] -- cgit v1.2.1 From 7ed1690c343dc16dfd5a5493589cbf74d503c238 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sun, 17 Feb 2013 19:16:01 -0500 Subject: user-manual: use -o latest.tar.gz to create a gzipped tarball This functionality was introduced by 0e804e09 (archive: provide builtin .tar.gz filter, 2011-07-21) for v1.7.7. Signed-off-by: W. Trevor King Signed-off-by: Junio C Hamano --- Documentation/user-manual.txt | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Documentation') diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt index 8074313f8..52c8523c7 100644 --- a/Documentation/user-manual.txt +++ b/Documentation/user-manual.txt @@ -931,11 +931,20 @@ The linkgit:git-archive[1] command can create a tar or zip archive from any version of a project; for example: ------------------------------------------------- -$ git archive --format=tar --prefix=project/ HEAD | gzip >latest.tar.gz +$ git archive -o latest.tar.gz --prefix=project/ HEAD ------------------------------------------------- -will use HEAD to produce a tar archive in which each filename is -preceded by "project/". +will use HEAD to produce a gzipped tar archive in which each filename +is preceded by `project/`. The output file format is inferred from +the output file extension if possible, see linkgit:git-archive[1] for +details. + +Versions of Git older than 1.7.7 don't know about the 'tar.gz' format, +you'll need to use gzip explicitly: + +------------------------------------------------- +$ git archive --format=tar --prefix=project/ HEAD | gzip >latest.tar.gz +------------------------------------------------- If you're releasing a new version of a software project, you may want to simultaneously make a changelog to include in the release -- cgit v1.2.1