Git Skills - zhuje/openshift-wiki GitHub Wiki

Add Upstream

  1. View what remote repositories you're currently linked to
    $ git remote -v
#returns 
origin <fork-repo-url> (fetch)
origin <fork-repo-url> (push)
  1. Add a the upstream repository
    $ git remote add upstream <original-repo-url>
#returns 
origin <fork-repo-url> (fetch)
origin <fork-repo-url> (push)
upstream <original-repo-url> (fetch)
upstream <original-repo-url> (push)
  1. Fetch latest commits from upstream repo
    $ git fetch upstream

Source:
https://adiati.com/git-how-to-fetch-a-branch-from-the-upstream-to-the-local-repo-in-5-steps

Sync Fork from Upstream

# get the latest commits from upstream repo 
$ git fetch upstream

# switch to 'main'/'master' branch 
$ git checkout main

# merge the latest upstream commits into your forked repo 
$ git merge upstream/main

# check the git logs to make sure you received the latest commits 
$ git log

Source:
https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork#syncing-a-fork-branch-from-the-command-line

Reset origin to new repo

git remote set-url origin git://new.url.here

Source:
https://stackoverflow.com/a/16330439/13661104

GPG

https://github.com/AICoE/workshop-intern-bootcamp-git/blob/main/0-set-up.md#step-07-configure-commit-signature-with-github-if-not-already-configured

Intern's Bootcamp

https://github.com/AICoE/workshop-intern-bootcamp-git

General Code Notations (reading documentation)

# any line that begins with a # (hashtag) is a comment 
$ any line that begins with a $ (dollar-sign) is a Command Line Argument to be entered into a CLI command line interface (e.g., a terminal)
$ <fooBar> any argument within <> (the greater and less than symbols) is supposed to be replaced with something specific determined by the user (e.g., $ open <fooFile>, $ open my_file.txt) 

github.dev editor

https://docs.github.com/en/codespaces/the-githubdev-web-based-editor image

image

Git Rebase

https://docs.google.com/document/d/1QzVjhJvBohDoR3Uj4PonT_c-Y31P4wgK3VdyWBSvr0Q/edit

⚠️ **GitHub.com Fallback** ⚠️