Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Tutorial / Git GitHub

Git GitHub

https://stackoverflow.com/questions/3605866/hide-password-when-checking-config-file-in-git https://stackoverflow.com/questions/48843026/hide-password-in-all-previous-commits-on-github-repo https://help.github.com/en/articles/removing-sensitive-data-from-a-repository https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line https://www.reddit.com/r/django/comments/8n8oj0/how_to_exclude_database_password_when_pushing_to/

crlf eol 2FA Two-Factor Authentication Manage Company-wide Secrets

$ git config --global user.email "you@example.com"
$ git config --global user.name "Your Name"
$ git config --global core.autocrlf input

Tutorial Video Git Workflow Use GitHub Like a Proper Human Being: non-technical advice Primer for Dummy

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

Undo Commits: last commit HEAD~ vs HEAD^

git reset vs git checkout vs git revert

Rebase

$ git reset HEAD^

$ git rebase origin/master

直接 git fetch origin 再 git merge origin/master 的副作用: 1) 強制產生 merge commit: 在 conflict 情況下通常是必要的動作, 但除此之外會讓 log 顯得雜亂 2) 讓最新完整的修改埋在舊版本裡

突發狀況的因應: git rebase --continue ; git rebase --abort

git-svn merge vs rebase

case: wrong branch

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)

Git Bisect

Action: the branch lingers around until the end of time

Creating Online Key

Hugo + Travis + Netlify https://medium.com/@i_AnkurBiswas/common-git-mistakes-and-how-to-fix-them-10184cd5fa77