@@ -931,11 +931,20 @@ The linkgit:git-archive[1] command can create a tar or zip archive from
931
931
any version of a project; for example:
932
932
933
933
-------------------------------------------------
934
- $ git archive --format= tar --prefix=project/ HEAD | gzip >latest.tar.gz
934
+ $ git archive -o latest. tar.gz --prefix=project/ HEAD
935
935
-------------------------------------------------
936
936
937
- will use HEAD to produce a tar archive in which each filename is
938
- preceded by "project/".
937
+ will use HEAD to produce a gzipped tar archive in which each filename
938
+ is preceded by `project/`. The output file format is inferred from
939
+ the output file extension if possible, see linkgit:git-archive[1] for
940
+ details.
941
+
942
+ Versions of Git older than 1.7.7 don't know about the 'tar.gz' format,
943
+ you'll need to use gzip explicitly:
944
+
945
+ -------------------------------------------------
946
+ $ git archive --format=tar --prefix=project/ HEAD | gzip >latest.tar.gz
947
+ -------------------------------------------------
939
948
940
949
If you're releasing a new version of a software project, you may want
941
950
to simultaneously make a changelog to include in the release
@@ -991,18 +1000,26 @@ Developing with Git
991
1000
Telling Git your name
992
1001
---------------------
993
1002
994
- Before creating any commits, you should introduce yourself to Git. The
995
- easiest way to do so is to make sure the following lines appear in a
996
- file named .gitconfig in your home directory:
1003
+ Before creating any commits, you should introduce yourself to Git.
1004
+ The easiest way to do so is to use linkgit:git-config[1]:
1005
+
1006
+ ------------------------------------------------
1007
+ $ git config --global user.name 'Your Name Comes Here'
1008
+ $ git config --global user.email '
[email protected] '
1009
+ ------------------------------------------------
1010
+
1011
+ Which will add the following to a file named `.gitconfig` in your
1012
+ home directory:
997
1013
998
1014
------------------------------------------------
999
1015
[user]
1000
1016
name = Your Name Comes Here
1001
1017
1002
1018
------------------------------------------------
1003
1019
1004
- (See the "CONFIGURATION FILE" section of linkgit:git-config[1] for
1005
- details on the configuration file.)
1020
+ See the "CONFIGURATION FILE" section of linkgit:git-config[1] for
1021
+ details on the configuration file. The file is plain text, so you can
1022
+ also edit it with your favorite editor.
1006
1023
1007
1024
1008
1025
[[creating-a-new-repository]]
@@ -1993,16 +2010,21 @@ See the description ofthe receive.denyCurrentBranch option
1993
2010
in linkgit:git-config[1] for details.
1994
2011
1995
2012
As with `git fetch`, you may also set up configuration options to
1996
- save typing; so, for example, after
2013
+ save typing; so, for example:
2014
+
2015
+ -------------------------------------------------
2016
+ $ git remote add public-repo ssh://yourserver.com/~you/proj.git
2017
+ -------------------------------------------------
2018
+
2019
+ adds the following to `.git/config`:
1997
2020
1998
2021
-------------------------------------------------
1999
- $ cat >>.git/config <<EOF
2000
2022
[remote "public-repo"]
2001
- url = ssh:// yourserver.com/~you/ proj.git
2002
- EOF
2023
+ url = yourserver.com: proj.git
2024
+ fetch = +refs/heads/*:refs/remotes/example/*
2003
2025
-------------------------------------------------
2004
2026
2005
- you should be able to perform the above push with just
2027
+ which lets you do the same push with just
2006
2028
2007
2029
-------------------------------------------------
2008
2030
$ git push public-repo master
@@ -2041,6 +2063,13 @@ branch name with a plus sign:
2041
2063
$ git push ssh://yourserver.com/~you/proj.git +master
2042
2064
-------------------------------------------------
2043
2065
2066
+ Note the addition of the `+` sign. Alternatively, you can use the
2067
+ `-f` flag to force the remote update, as in:
2068
+
2069
+ -------------------------------------------------
2070
+ $ git push -f ssh://yourserver.com/~you/proj.git master
2071
+ -------------------------------------------------
2072
+
2044
2073
Normally whenever a branch head in a public repository is modified, it
2045
2074
is modified to point to a descendant of the commit that it pointed to
2046
2075
before. By forcing a push in this situation, you break that convention.
@@ -2845,48 +2874,34 @@ branch.master.merge=refs/heads/master
2845
2874
2846
2875
If there are other repositories that you also use frequently, you can
2847
2876
create similar configuration options to save typing; for example,
2848
- after
2849
2877
2850
2878
-------------------------------------------------
2851
- $ git config remote. example.url git://example.com/proj.git
2879
+ $ git remote add example git://example.com/proj.git
2852
2880
-------------------------------------------------
2853
2881
2854
- then the following two commands will do the same thing :
2882
+ adds the following to `.git/config` :
2855
2883
2856
2884
-------------------------------------------------
2857
- $ git fetch git://example.com/proj.git master:refs/remotes/example/master
2858
- $ git fetch example master:refs/remotes/example/master
2885
+ [remote "example"]
2886
+ url = git://example.com/proj.git
2887
+ fetch = +refs/heads/*:refs/remotes/example/*
2859
2888
-------------------------------------------------
2860
2889
2861
- Even better, if you add one more option:
2862
-
2863
- -------------------------------------------------
2864
- $ git config remote.example.fetch master:refs/remotes/example/master
2865
- -------------------------------------------------
2890
+ Also note that the above configuration can be performed by directly
2891
+ editing the file `.git/config` instead of using linkgit:git-remote[1].
2866
2892
2867
- then the following commands will all do the same thing:
2893
+ After configuring the remote, the following three commands will do the
2894
+ same thing:
2868
2895
2869
2896
-------------------------------------------------
2870
- $ git fetch git://example.com/proj.git master :refs/remotes/example/master
2871
- $ git fetch example master :refs/remotes/example/master
2897
+ $ git fetch git://example.com/proj.git +refs/heads/* :refs/remotes/example/*
2898
+ $ git fetch example +refs/heads/* :refs/remotes/example/*
2872
2899
$ git fetch example
2873
2900
-------------------------------------------------
2874
2901
2875
- You can also add a "+" to force the update each time:
2876
-
2877
- -------------------------------------------------
2878
- $ git config remote.example.fetch +master:refs/remotes/example/master
2879
- -------------------------------------------------
2880
-
2881
- Don't do this unless you're sure you won't mind "git fetch" possibly
2882
- throwing away commits on 'example/master'.
2883
-
2884
- Also note that all of the above configuration can be performed by
2885
- directly editing the file .git/config instead of using
2886
- linkgit:git-config[1].
2887
-
2888
2902
See linkgit:git-config[1] for more details on the configuration
2889
- options mentioned above.
2903
+ options mentioned above and linkgit:git-fetch[1] for more details on
2904
+ the refspec syntax.
2890
2905
2891
2906
2892
2907
[[git-concepts]]
0 commit comments