Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Tutorial / Git GitHub

Git GitHub

Use GitHub Like a Proper Human Being: non-technical advice

Merge vs Rebase PyCon 2015 Talk on Advanced Git: Video Slide

git reset vs git checkout vs git revert

Rebase

$ git reset HEAD^

git-svn merge vs rebase

Rewriting History

# Changing the Last Commit
$ git commit --amend

技術上,上述動作會修改 Commit 的 SHA-1 值,像是個微型的 Rebase 動作,如果已經 Push 的話,就不要再執行 Amend 動作。

Cherry Pick: from another repository

github-collective: team management

$ git rebase master
First, rewinding head to replay your work on top of it...
Applying: Remove Grok Dependency for Cover View.
Using index info to reconstruct a base tree...
M       CHANGES.rst
M       src/collective/cover/browser/cover.py
Falling back to patching base and 3-way merge...
Auto-merging src/collective/cover/browser/cover.py
CONFLICT (content): Merge conflict in src/collective/cover/browser/cover.py
Auto-merging CHANGES.rst
Failed to merge in the changes.
Patch failed at 0001 Remove Grok Dependency for Cover View.
The copy of the patch that failed is found in:
   /home/marr/collective.cover/.git/rebase-apply/patch

When you have resolved this problem, run "git rebase --continue".
If you prefer to skip this patch, run "git rebase --skip" instead.
To check out the original branch and stop rebasing, run "git rebase --abort".

Full Log + Cherry Pick

$ git log --graph --decorate --pretty=oneline --abbrev-commit --all
import os

lines = """
https://github.com/collective/collective.geo.bundle.git
https://github.com/collective/collective.geo.contentlocations.git
"""

for line in lines.split('\n'):
    if line == '': continue
    cmd = 'git clone ' + line
    os.system(cmd)