This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
kurs:git [2010/05/18 11:15] 127.0.0.1 external edit |
kurs:git [2014/09/10 21:22] (current) |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | "checkout" | + | ==== initialer checkout = clone ==== |
| git clone git@github.com:MarkHofstetter/zend-hr-employees.git | git clone git@github.com:MarkHofstetter/zend-hr-employees.git | ||
| + | |||
| + | |||
| + | ==== Bestimmes file aus einer bestimmten revision auschecken ==== | ||
| + | |||
| + | git checkout abcde file/to/restore | ||
| + | |||
| + | ==== Alle - auch remote - branches anzeigen (geht logischerweise erst nach einem pull) ==== | ||
| + | |||
| + | ''> git branch -a'' | ||
| + | |||
| + | danach lokalen tracking branch erstellen | ||
| + | |||
| + | ''> git checkout -b develop remotes/origin/develop'' | ||
| + | |||
| + | topic branch abzweigen (branchen) | ||
| + | |||
| + | ''> git checkout -b topic --track develop'' | ||
| + | |||
| + | gegebenenfalls ins repo schieben | ||
| + | |||
| + | ''> git push origin topic'' | ||
| + | |||
| + | Entwickeln & testen ggf mehrere commits und pushes auf das repo | ||
| + | |||
| + | wenn fertig | ||
| + | |||
| + | ''> git checkout develop'' | ||
| + | |||
| + | ''> git merge --no-ff topic'' | ||
| + | |||
| + | ''> git push'' | ||
| + | |||
| + | |||
| + | ==== Mergen ==== | ||
| + | |||
| + | Problem: wenn zwischen einem pull --rebase auf lokalem repo A "etwas" widersprüchliches zu einem push von lokalem repo B passiert | ||
| + | |||
| + | <code> | ||
| + | >git pull --rebase | ||
| + | remote: Counting objects: 5, done. | ||
| + | remote: Compressing objects: 100% (1/1), done. | ||
| + | remote: Total 3 (delta 1), reused 3 (delta 1) | ||
| + | Unpacking objects: 100% (3/3), done. | ||
| + | From github.com:MarkHofstetter/kurs-employee | ||
| + | 0d61041..2ae5a03 Mark -> origin/Mark | ||
| + | First, rewinding head to replay your work on top of it... | ||
| + | Applying: changed d to 300 | ||
| + | Using index info to reconstruct a base tree... | ||
| + | Falling back to patching base and 3-way merge... | ||
| + | Auto-merging git_test.txt | ||
| + | CONFLICT (content): Merge conflict in git_test.txt | ||
| + | Failed to merge in the changes. | ||
| + | Patch failed at 0001 changed d to 300 | ||
| + | |||
| + | When you have resolved this problem run "git rebase --continue". | ||
| + | If you would prefer to skip this patch, instead run "git rebase --skip". | ||
| + | To restore the original branch and stop rebasing run "git rebase --abort". | ||
| + | </code> | ||
| + | |||
| + | Manuelles reparieren der Konflikte | ||
| + | |||
| + | >git add git_test.txt | ||
| + | |||
| + | >git commit -m "treffen in der Mitte d = 250" | ||
| + | [detached HEAD e1ddd18] treffen in der Mitte d = 250 | ||
| + | 1 files changed, 2 insertions(+), 2 deletions(-) | ||
| + | |||
| + | >git rebase --continue | ||
| + | Applying: changed d to 300 | ||
| + | No changes - did you forget to use 'git add'? | ||
| + | |||
| + | When you have resolved this problem run "git rebase --continue". | ||
| + | If you would prefer to skip this patch, instead run "git rebase --skip". | ||
| + | To restore the original branch and stop rebasing run "git rebase --abort". | ||
| + | |||
| + | |||
| + | >git rebase --skip | ||
| + | HEAD is now at e1ddd18 treffen in der Mitte d = 250 | ||
| + | Nothing to do. | ||
| + | |||
| + | >git push | ||
| + | |||
| + | |||
| + | |||
| + | === Aus einem vorhandenen repo ein remote machen === | ||
| + | |||
| + | [[http://qugstart.com/blog/ruby-and-rails/create-a-new-git-remote-repository-from-some-local-files-or-local-git-repository/|remote repo anlegen]] | ||
| + | |||
| + | |||
| + | |||
| + | |||
| + | |||