Git: Unterschied zwischen den Versionen

aus Metalab Wiki, dem offenen Zentrum für meta-disziplinäre Magier und technisch-kreative Enthusiasten.
Zur Navigation springenZur Suche springen
(3 dazwischenliegende Versionen von 2 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
 
= Intro =
 
= Intro =
 
Git is a version control system. It's more powerful than svn and quite confusing (for starters).
 
Git is a version control system. It's more powerful than svn and quite confusing (for starters).
 +
 +
= Workshops =
 +
 +
== Workshop #1 ==
 +
 +
2012-10-08: '''[http://haraldschilly.github.com/yagt YAGT Talk]''' by [[user:Hasch|HaSch]]  ([http://github.com/haraldschilly/yagt sources@github])
 +
 +
=First Steps=
  
 
== Git Installation ==
 
== Git Installation ==
Zeile 10: Zeile 18:
 
UI (there are several possibilities)
 
UI (there are several possibilities)
  
     sudo apt-get install git-cola gitk
+
     sudo apt-get install qgit git-cola gitk tig
  
 
=== OS X ===
 
=== OS X ===
Zeile 16: Zeile 24:
 
* [http://help.github.com/mac-key-setup/ github mac key setup]
 
* [http://help.github.com/mac-key-setup/ github mac key setup]
  
== Git Introduction / Tutorial ==
+
=== MS Windows ===
  
<pre>git clone someurl</pre>
+
* [http://www.syntevo.com/smartgit/ SmartGit]
 +
* [http://msysgit.github.com/ msysGit]
  
<pre>git pull</pre>
+
= Git Introduction / Tutorial =
  
<pre>git commit file -m "holla"
+
<pre>git clone fromsomeurl
 +
or
 +
git init
 +
</pre>
 +
 
 +
<pre>git pull --rebase</pre>
 +
 
 +
<pre>git add file</pre>
 +
 
 +
<pre>git commit -m "holla"
 
git push</pre>
 
git push</pre>
  
<pre>git stash # stacks away
+
<pre>git stash # stashes uncommited changes away
git stash apply # gets stash back</pre>
+
git stash apply # gets stash back and applies it</pre>
 +
 
 +
<pre>git branch --track thebranch origin/thebranch</pre> switch to a remote branch and track it
 +
 
 +
= sample ~/.gitconfig =
 +
 
 +
<pre>
 +
[mergetool]
 +
keepBackup = 0
 +
 
 +
[user]
 +
name = Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯
 +
email = daxim@cpan.org
 +
signingkey = 0xE5F4D07A
 +
 
 +
[color]
 +
ui = auto
 +
 
 +
[diff "opendocument"]
 +
textconv = odt2txt
 +
 
 +
[diff "excel"]
 +
textconv = xls2csv
 +
 
 +
[diff "perl"]
 +
xfuncname = ^\\s*(sub.*)
 +
 
 +
[alias]
 +
# commands listed in order of amount of usage
 +
s = status -s
 +
l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
 +
# also rarely: git l --all
 +
raw = show --format=raw
 +
cp = cherry-pick
 +
mt = mergetool -t kdiff3
 +
a = add
 +
d = diff # also: git d -w
 +
up = pull --rebase
 +
# git svn fetch
 +
re = svn rebase
 +
ba = branch -a
 +
dc = diff --cached # also: git dc -w
 +
c = commit
 +
rh = reset --hard
 +
co = checkout
 +
ca = commit --amend
 +
dco = svn dcommit --user=daxim
 +
# git push
 +
st = stash
 +
pop = stash pop
 +
rc = rebase --continue
 +
# git reflog
 +
# git init
 +
# git rebase
 +
# git am
 +
# git tag
 +
f = format-patch # git -f 1 ; mail 000*.patch
 +
wu = log --stat origin..@{0} # what will be pushed upstream? overview
 +
wup = log -p origin..@{0} # what will be pushed upstream? treediff
 +
# git mergetool
 +
# git fetch
 +
# git merge
 +
pack = gc --aggressive
 +
check = fsck --unreachable --root --tags --full --strict --lost-found
 +
ai = add --interactive
 +
ri = rebase --interactive
 +
b = branch
 +
# git remote
 +
# git mv
 +
ap = add --patch
 +
r = reset
 +
ls = stash list
 +
sh = stash show
 +
au = shortlog -s # authors
 +
# unpack-refs = "!bash -c 'IFS=$''\\n''; for f in $(git show-ref --heads); do /bin/echo ''Writing  '' $(echo $f | cut -c42-); echo $(echo $f | cut -c1-40) > \"${GIT_DIR:-.git}/$(echo $f | cut -c42-)\"; done'"
 +
expire1 = reflog expire --expire=now --all
 +
expire2 = gc --prune=now
 +
 
 +
[gui]
 +
fontui = -family \"DejaVu Sans\" -size 12 -weight normal -slant roman -underline 0 -overstrike 0
 +
fontdiff = -family \"DejaVu Sans Mono\" -size 12 -weight normal -slant roman -underline 0 -overstrike 0
  
<pre>git branch --track thebranch origin/thebranch</pre> switch to a remote branch
+
[github]
 +
user = daxim
 +
token = affeaffeaffeaffeaffeaffeaffeaffe
 +
</pre>

Version vom 9. Oktober 2012, 21:42 Uhr

Intro

Git is a version control system. It's more powerful than svn and quite confusing (for starters).

Workshops

Workshop #1

2012-10-08: YAGT Talk by HaSch (sources@github)

First Steps

Git Installation

Linux

   sudo apt-get install git

UI (there are several possibilities)

   sudo apt-get install qgit git-cola gitk tig

OS X

MS Windows

Git Introduction / Tutorial

git clone fromsomeurl
or
git init
git pull --rebase
git add file
git commit -m "holla"
git push
git stash # stashes uncommited changes away
git stash apply # gets stash back and applies it
git branch --track thebranch origin/thebranch

switch to a remote branch and track it

sample ~/.gitconfig

[mergetool]
keepBackup = 0

[user]
name = Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯
email = daxim@cpan.org
signingkey = 0xE5F4D07A

[color]
ui = auto

[diff "opendocument"]
textconv = odt2txt

[diff "excel"]
textconv = xls2csv

[diff "perl"]
xfuncname = ^\\s*(sub.*)

[alias]
# commands listed in order of amount of usage
s = status -s
l = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
# also rarely: git l --all
raw = show --format=raw
cp = cherry-pick
mt = mergetool -t kdiff3
a = add
d = diff # also: git d -w
up = pull --rebase
# git svn fetch
re = svn rebase
ba = branch -a
dc = diff --cached # also: git dc -w
c = commit
rh = reset --hard
co = checkout
ca = commit --amend
dco = svn dcommit --user=daxim
# git push
st = stash
pop = stash pop
rc = rebase --continue
# git reflog
# git init
# git rebase
# git am
# git tag
f = format-patch # git -f 1 ; mail 000*.patch
wu = log --stat origin..@{0} # what will be pushed upstream? overview
wup = log -p origin..@{0} # what will be pushed upstream? treediff
# git mergetool
# git fetch
# git merge
pack = gc --aggressive
check = fsck --unreachable --root --tags --full --strict --lost-found
ai = add --interactive
ri = rebase --interactive
b = branch
# git remote
# git mv
ap = add --patch
r = reset
ls = stash list
sh = stash show
au = shortlog -s # authors
# unpack-refs = "!bash -c 'IFS=$''\\n''; for f in $(git show-ref --heads); do /bin/echo ''Writing  '' $(echo $f | cut -c42-); echo $(echo $f | cut -c1-40) > \"${GIT_DIR:-.git}/$(echo $f | cut -c42-)\"; done'"
expire1 = reflog expire --expire=now --all
expire2 = gc --prune=now

[gui]
fontui = -family \"DejaVu Sans\" -size 12 -weight normal -slant roman -underline 0 -overstrike 0
fontdiff = -family \"DejaVu Sans Mono\" -size 12 -weight normal -slant roman -underline 0 -overstrike 0

[github]
user = daxim
token = affeaffeaffeaffeaffeaffeaffeaffe