Benutzer-Werkzeuge

Webseiten-Werkzeuge


becki:linux:git

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Nächste Überarbeitung
Vorhergehende Überarbeitung
becki:linux:git [2010-07-22 15:17]
becki created
becki:linux:git [2025-01-08 10:11] (aktuell)
becki
Zeile 1: Zeile 1:
 ====== Git Tips == ====== Git Tips ==
-===== Links ==+===== Getting Help  ​==
  
 +  git help
 +  git help <​command>​
 +  cat .git/config
 +
 +https://​www.kernel.org/​pub/​software/​scm/​git/​docs/​
 +
 +
 +===== Mercurial Command Comparison ​ ==
 +
 +See https://​www.rath.org/​mercurial-for-git-users-and-vice-versa.html to understand the different concepts
 +See [[hg>​wiki/​GitConcepts|Mercurial <=> Git Command comparison]]
 +
 +^ hg ^ git ^ comment ^
 +| hg backout | git revert | options my differ |
 +| hg branches | git branch [-a] | |
 +| hg commit -m '​msg'​ | git commit -a -m '​msg'​ | from trial / alternative:​ ''​git add ...; git commit''​ |
 +| hg diff -c -1 | ''​git diff @{0}^!''​ or ''​git show @{0}''​ | See diffs of last commit (tip) |
 +| hg diff -c -2 | ''​git diff @{1}^!''​ or ''​git show @{1}''​ | See diffs of penultimate commit |
 +| hg glog | git log --graph | |
 +| hg glog -v | git log --name-only | |
 +| hg init | git init | from trial |
 +| hg pull -u | git pull [url] | URL may be specified, otherwise remot tracking thing is used? |
 +| hg push | git push | See below |
 +| hg status; hg outgoing | git status | |
 +| hg uptdate ... | git checkout ... | |
 +
 +===== Push ==
 +
 +In order to push from repo S to reop T, T must not be on the branch you want to push to (typically master). Therefore create a dummy branch ''​git checkout -b dummy''​ on T. Now you can push to T/master from S
 +
 +Alternatively you can turn T into a "​bare"​ repo.
 +
 +See also http://​stackoverflow.com/​questions/​2816369
 +
 +===== Clone ==
 +
 +Example: Using SSH from within the remote home dir
 +
 +  git clone ssh://​[user@]host/​~user/​tmp/​igit igitigit
 +  ​
 +See ''​git help clone''​ (also for valid URL formats)
 +
 +<note warning>​The result of ''​git clone <​url>''​ without specifying a branch name is dependent on which branch the source repo currently is!</​note>​
 +
 +===== Branches ==
 +
 +''​git branch''​ shows existing local branches, while ''​git branch -r''​ causes the "​remote-tracking"​ branches to be listed, and option -a shows both. See [[http://​www.kernel.org/​pub/​software/​scm/​git/​docs/​git-branch.html|git-branch]]
 +
 +With Git it is not possible to directly swich to a different branch on a cloned repository like in Mercurial. Instead first you have to create a new (local) branch wich "​tracks"​ the specified remote brach, eg. (''​origin/​stable''​) and then checkout (=update) this branch to your working directory. The following command does both steps at once:
 +
 +  git checkout -b stable origin/​stable
 +
 +Now you can pull all needed updates whenever a new release is made:
 +
 +  git pull
 +
 +[[http://​stevelosh.com/​blog/​2009/​08/​a-guide-to-branching-in-mercurial/​|See also]]
 +
 +===== General Links ==
 +
 +  * [[http://​nfarina.com/​post/​9868516270/​git-is-simpler|Probably good intro]]
   * [[Mercurial Tips]] --- [[SVN Tips]] --- [[CVS Tips]]   * [[Mercurial Tips]] --- [[SVN Tips]] --- [[CVS Tips]]
-  * [[hg>​wiki/​GitConcepts|Mercurial <=> Git Command comparison]] 
   * [[http://​www.kernel.org/​pub/​software/​scm/​git/​docs/​gittutorial.html|man gittutorial]]   * [[http://​www.kernel.org/​pub/​software/​scm/​git/​docs/​gittutorial.html|man gittutorial]]
   * [[http://​www.kernel.org/​pub/​software/​scm/​git/​docs/​user-manual.html|Git User's Manual]]   * [[http://​www.kernel.org/​pub/​software/​scm/​git/​docs/​user-manual.html|Git User's Manual]]
 +  * [[http://​steveko.wordpress.com/​2012/​02/​24/​10-things-i-hate-about-git/​|10 things I hate about Git]]
 +  * [[http://​think-like-a-git.net/​|Think Like (a) Git]]
 +
becki/linux/git.1279811857.txt.gz · Zuletzt geändert: 2010-07-22 15:17 von becki

Impressum - Datenschutzerklärung