Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Tutorial / Git GitHub

Git GitHub

設定檔 流程 認證 https://devops.substack.com/p/top-github-apps-you-should-know-about https://www.facebook.com/groups/pythontw/permalink/10160990962513438/ action

入門教學 Tutorial Video crlf eol Manage Company-wide Secrets Strategy to Reduce Frontend Build Time

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

Git Workflow Use GitHub Like a Proper Human Being: non-technical advice Primer for Dummy 2FA Two-Factor Authentication Common Git Mistakes and how to fix them

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

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://help.github.com/articles/mapping-geojson-files-on-github/ Exclude Database Password when pushing to GitHub

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

GitLab CI https://www.youtube.com/watch?v=L4kMIkRE9DA Droid GitHub page