Last active
July 1, 2025 23:27
-
-
Save rgreenjr/96d182fe3c47ed6fce82 to your computer and use it in GitHub Desktop.
Revisions
-
rgreenjr revised this gist
Oct 7, 2021 . 1 changed file with 0 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -172,24 +172,3 @@ git merge upstream/master git checkout FEATURE_BRANCH git rebase master ``` -
rgreenjr revised this gist
Sep 18, 2019 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -120,6 +120,12 @@ git checkout development git merge --no-ff branch_name ``` ```sh # add tag git tag 1.2.3 git push origin v1.2.3 ``` ## Contributing to Open Source - [How to Rebase a Pull Request](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request) -
rgreenjr revised this gist
Feb 27, 2019 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -185,6 +185,5 @@ git remote set-url origin /Users/rgreen/git/my_project.git cd ~/code git clone rons-imac.local:/Users/rgreen/git/my_project.git cd my_project git remote set-url origin rons-imac.local:/Users/rgreen/git/my_project.git ``` -
rgreenjr revised this gist
Feb 27, 2019 . 1 changed file with 9 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -172,15 +172,19 @@ git rebase master ```sh # make bare copy of repo cd ~/code git clone --bare my_project /Users/rgreen/git/my_project.git # clone repo locally (see below for non-local) cd ~/code git clone /Users/rgreen/git/my_project.git cd my_project git remote set-url origin /Users/rgreen/git/my_project.git # clone repo non-locally (see above for local) cd ~/code git clone rons-imac.local:/Users/rgreen/git/my_project.git cd my_project git clone rons-imac.local:/Users/rgreen/git/my_project.git git remote set-url origin rons-imac.local:/Users/rgreen/git/my_project.git ``` -
rgreenjr revised this gist
Aug 21, 2018 . 1 changed file with 11 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -171,8 +171,16 @@ git rebase master ## Hosting Non-Public Repos ```sh # make bare copy of repo git clone --bare project /Users/rgreen/git/project.git # clone repo locally (see below for non-local) cd ~/code git clone /Users/rgreen/git/project.git git remote set-url origin /Users/rgreen/git/project.git # clone repo non-locally (see above for local) cd ~/code git clone rons-imac.local:/Users/rgreen/git/project.git git remote set-url origin rons-imac.local:/Users/rgreen/git/project.git ``` -
rgreenjr revised this gist
Aug 21, 2018 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -172,6 +172,7 @@ git rebase master ```sh git clone --bare my_project /Users/rgreen/git/my_project.git cd ~/code git clone /Users/rgreen/git/my_project.git git remote set-url origin /Users/rgreen/git/my_project.git ``` -
rgreenjr revised this gist
Aug 21, 2018 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -171,5 +171,7 @@ git rebase master ## Hosting Non-Public Repos ```sh git clone --bare my_project /Users/rgreen/git/my_project.git git clone /Users/rgreen/git/my_project.git git remote set-url origin /Users/rgreen/git/my_project.git ``` -
rgreenjr revised this gist
Aug 21, 2018 . 1 changed file with 7 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -165,4 +165,11 @@ git merge upstream/master # if there were any new commits, rebase your development branch git checkout FEATURE_BRANCH git rebase master ``` ## Hosting Non-Public Repos ```sh git clone --bare my_project ~/code/my_project.git ``` -
rgreenjr revised this gist
Aug 15, 2017 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -122,7 +122,8 @@ git merge --no-ff branch_name ## Contributing to Open Source - [How to Rebase a Pull Request](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request) - [GitHub Standard Fork & Pull Request Workflow](https://gist.github.com/Chaser324/ce0505fbed06b947d962) ### Creating a Fork -
rgreenjr revised this gist
Aug 15, 2017 . 1 changed file with 7 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ # Git Cheat Sheet ## Common Commands ```sh # stage all modified files being tracked git add -u @@ -116,14 +120,11 @@ git checkout development git merge --no-ff branch_name ``` ## Contributing to Open Source [How to Rebase a Pull Request](https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request) ### Creating a Fork ```sh # clone the origianl repo -
rgreenjr revised this gist
Aug 15, 2017 . 1 changed file with 66 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,104 +3,164 @@ git add -u ``` ```sh # revert file git checkout -- filepath ``` ```sh # change comment of last commit git commit --amend ``` ```sh # unstage all files git reset HEAD ``` ```sh # unstage one file git reset HEAD -- filepath ``` ```sh # undo last commit (leaving files in index) git reset --soft HEAD~ ``` ```sh # undo last commit and unstage all files git reset HEAD~ ``` ```sh # revert to last local commit (throwing away changes) git reset --hard ``` ```sh # revert changes of a merge git reset --hard ORIG_HEAD ``` ```sh # show difference between the HEAD and the index git diff --staged ``` ```sh # show diff between HEAD and both staged and unstaged changes (what would be committed with 'git commit -a') git diff HEAD ``` ```sh # diff two branches git diff --stat branch1...branch2 ``` ```sh # show history git log --graph --oneline ``` ```sh # find the most recent common ancestor of two branches git merge-base branch1 branch2 ``` ```sh # remove deleted files from git git status | grep deleted | awk '{print \$3}' | xargs git rm ``` ```sh # show information about your remotes git remote show origin ``` ```sh # set up tracking remote branch git remote add origin [email protected]:rgreenjr/foobar.git ``` ```sh # push local branch with tracking to remote repo git push -u origin FEATURE_BRANCH ``` ```sh # pull remote branch to local repo git fetch origin git checkout --track origin/branch_name ``` ```sh # delete remote branch git push origin --delete branch_name ``` ```sh # cleanup stale remote branches git remote prune origin ``` ```sh # rebase development branch onto local feature branch (usually prior to merging feature branch onto development branch) git checkout branch_name git rebase development ``` ```sh # merge local feature branch onto development without fast-forwarding git checkout development git merge --no-ff branch_name ``` # How to Rebase a Pull Request https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request ## Contributing to Open Source ```sh # clone the origianl repo git clone [email protected]:USERNAME/FORKED_PROJECT.git ``` ```sh # add 'upstream' repo to list of remotes git remote add upstream [email protected]:UPSTREAM_USER/ORIGINAL_PROJECT.git ``` ```sh # verify the new remote named 'upstream' git remote -v ``` ```sh # create a new branch git checkout -b FEATURE_BRANCH ``` ```sh # push new feature branch to cloned repo with tracking git push -u origin FEATURE_BRANCH ``` ### Submitting a Pull Request ```sh # fetch upstream master and merge with your repo's master branch git fetch upstream git checkout master git merge upstream/master ``` ```sh # if there were any new commits, rebase your development branch git checkout FEATURE_BRANCH git rebase master ``` -
rgreenjr revised this gist
Aug 15, 2017 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,5 @@ ```sh # stage all modified files being tracked git add -u ``` -
rgreenjr revised this gist
Aug 15, 2017 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ # stage all modified files being tracked ```sh git add -u ``` # revert file git checkout -- filepath -
rgreenjr renamed this gist
Aug 15, 2017 . 1 changed file with 4 additions and 25 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,7 +50,7 @@ git remote show origin git remote add origin [email protected]:rgreenjr/foobar.git # push local branch with tracking to remote repo git push -u origin FEATURE_BRANCH # pull remote branch to local repo git fetch origin @@ -70,33 +70,9 @@ git rebase development git checkout development git merge --no-ff branch_name # How to Rebase a Pull Request https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request ############################# # contributing to open source ############################# @@ -113,6 +89,9 @@ git remote -v # create a new branch git checkout -b FEATURE_BRANCH # push new feature branch to cloned repo with tracking git push -u origin FEATURE_BRANCH # submitting a pull request # fetch upstream master and merge with your repo's master branch -
rgreenjr revised this gist
Aug 15, 2017 . 1 changed file with 29 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -94,3 +94,32 @@ git push # How to Rebase a Pull Request https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request ############################# # contributing to open source ############################# # clone the origianl repo git clone [email protected]:USERNAME/FORKED_PROJECT.git # add 'upstream' repo to list of remotes git remote add upstream [email protected]:UPSTREAM_USER/ORIGINAL_PROJECT.git # verify the new remote named 'upstream' git remote -v # create a new branch git checkout -b FEATURE_BRANCH # submitting a pull request # fetch upstream master and merge with your repo's master branch git fetch upstream git checkout master git merge upstream/master # if there were any new commits, rebase your development branch git checkout FEATURE_BRANCH git rebase master -
rgreenjr revised this gist
Mar 8, 2016 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -90,7 +90,6 @@ git fetch upstream git merge upstream/master git checkout new_branch git rebase master git push # How to Rebase a Pull Request -
rgreenjr revised this gist
Mar 7, 2016 . 1 changed file with 8 additions and 7 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,21 +76,22 @@ git merge --no-ff branch_name # clone the origianl repo git clone [email protected]/foobar/foobar.git --recursive git remote add upstream [email protected]:foobar/foobar.git # create a new branch git checkout -b new_branch # push new branch to cloned repo with tracking git push -u origin new_branch # pull and rebase before issuing pull request git checkout master git fetch upstream git merge upstream/master git checkout new_branch git rebase master git checkout new_branch git push # How to Rebase a Pull Request https://github.com/edx/edx-platform/wiki/How-to-Rebase-a-Pull-Request -
rgreenjr revised this gist
Mar 7, 2016 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -70,10 +70,27 @@ git rebase development git checkout development git merge --no-ff branch_name ############################# # contributing to open source ############################# # clone the origianl repo git clone [email protected]/foobar/foobar.git --recursive # add repo as upstream git remote add upstream [email protected]:foobar/foobar.git git fetch upstream git merge upstream/master # create a new branch git checkout -b new_branch_name # push new branch to cloned repo with tracking git push -u origin new_branch_name # pull and rebase before issuing pull request git checkout master git fetch upstream git merge upstream/master git checkout new_branch_name git rebase master -
rgreenjr revised this gist
Mar 7, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -76,4 +76,4 @@ git remote add upstream [email protected]:foobar/foobar.git git fetch upstream git merge upstream/master git checkout -b new_branch_name git push -u origin new_branch_name -
rgreenjr revised this gist
Mar 7, 2016 . 1 changed file with 9 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,4 +68,12 @@ git rebase development # merge local feature branch onto development without fast-forwarding git checkout development git merge --no-ff branch_name # contributing to open source git clone [email protected]/foobar/foobar.git --recursive git remote add upstream [email protected]:foobar/foobar.git git fetch upstream git merge upstream/master git checkout -b new_branch_name git push origin new_branch_name -
rgreenjr revised this gist
Mar 2, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ git reset HEAD # unstage one file git reset HEAD -- filepath # undo last commit (leaving files in index) git reset --soft HEAD~ # undo last commit and unstage all files -
rgreenjr revised this gist
Mar 2, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ git reset HEAD # unstage one file git reset HEAD -- filepath # undo last commit (but leave files in index) git reset --soft HEAD~ # undo last commit and unstage all files -
rgreenjr revised this gist
Mar 2, 2016 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,13 @@ git reset HEAD # unstage one file git reset HEAD -- filepath # undo last commit (wihtout unstaging) git reset --soft HEAD~ # undo last commit and unstage all files git reset HEAD~ # revert to last local commit (throwing away changes) git reset --hard # revert changes of a merge -
rgreenjr revised this gist
Mar 2, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ git checkout -- filepath # change comment of last commit git commit --amend # unstage all files git reset HEAD # unstage one file -
rgreenjr revised this gist
Mar 2, 2016 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,13 @@ git add -u # revert file git checkout -- filepath # change comment of last commit git commit --amend # unstage all file git reset HEAD # unstage one file git reset HEAD -- filepath # revert to last local commit -
rgreenjr renamed this gist
Sep 8, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
rgreenjr revised this gist
Dec 4, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -54,6 +54,6 @@ git remote prune origin git checkout branch_name git rebase development # merge local feature branch onto development without fast-forwarding git checkout development git merge --no-ff branch_name -
rgreenjr revised this gist
Dec 4, 2014 . 1 changed file with 11 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -38,14 +38,22 @@ git remote show origin git remote add origin [email protected]:rgreenjr/foobar.git # push local branch with tracking to remote repo git push -u origin branch_name # pull remote branch to local repo git fetch origin git checkout --track origin/branch_name # delete remote branch git push origin --delete branch_name # cleanup stale remote branches git remote prune origin # rebase development branch onto local feature branch (usually prior to merging feature branch onto development branch) git checkout branch_name git rebase development # merge local feature branch into development git checkout development git merge branch_name -
rgreenjr revised this gist
Oct 13, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -37,7 +37,7 @@ git remote show origin # set up tracking remote branch git remote add origin [email protected]:rgreenjr/foobar.git # push local branch with tracking to remote repo git push -u origin branch # pull remote branch to local repo -
rgreenjr revised this gist
Oct 3, 2014 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,3 +46,6 @@ git checkout --track origin/branch # delete remote branch git push origin --delete branch # cleanup stale remote branches git remote prune origin
NewerOlder