Last active
July 25, 2021 20:13
-
-
Save ryuichi24/c246d93efb26a945643b8175da560559 to your computer and use it in GitHub Desktop.
Revisions
-
ryuichi24 revised this gist
Jul 25, 2021 . 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 @@ -12,6 +12,9 @@ ## commit changes to new commmit object being ready for remote repository `git commit -m "<comment>"` ## amend last commit message `git commit --amend -m <new message>` ## push the committed changes to the remote repository `git push <remote> <branch>` -
ryuichi24 revised this gist
Jul 20, 2021 . 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 @@ -33,6 +33,9 @@ ## remove remote branch `git push origin --delete <branch name>` ## set upstream for a local branch `git branch --set-upstream-to=origin/<remote branch> <local branch>` ## update local repository with remote branch references `git fetch` -
ryuichi24 revised this gist
Jul 18, 2021 . 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 @@ -27,6 +27,12 @@ ## create a new branch and swich to it `git checkout -b <new branch name>` ## remove local branch `git branch -d <branch name>` ## remove remote branch `git push origin --delete <branch name>` ## update local repository with remote branch references `git fetch` -
ryuichi24 revised this gist
Jul 16, 2021 . 1 changed file with 3 additions and 9 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,21 +54,15 @@ ## delete all stashed changes `git stash clear` ## reset to a certain commit with soft `git reset --soft <commit hash>` ## reset to a certain commit with hard `git reset --hard <commit hash>` ## force push with reset local branch `git push --force-with-lease origin <branch name>` ## ignore file `git update-index --assume-unchanged <file name>` -
ryuichi24 revised this gist
Jul 1, 2021 . 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 @@ -57,6 +57,12 @@ ## undo a git push `git push -f origin HEAD^:main` ## reset to a certain commit `git reset --hard <commit hash>` ## force push with reset local branch `git push --force-with-lease origin <branch name>` ## undo last commit (preserves working tree) `git reset --soft HEAD~1` -
ryuichi24 revised this gist
Jun 22, 2021 . 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 @@ -58,7 +58,7 @@ `git push -f origin HEAD^:main` ## undo last commit (preserves working tree) `git reset --soft HEAD~1` ## undo last commit (lose working tree) `git reset --hard HEAD^` -
ryuichi24 revised this gist
Jun 17, 2021 . 1 changed file with 4 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 @@ -64,4 +64,7 @@ `git reset --hard HEAD^` ## ignore file `git update-index --assume-unchanged <file name>` ## undo ignore file `git update-index --no-assume-unchanged <file>` -
ryuichi24 revised this gist
Jun 17, 2021 . 1 changed file with 4 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 @@ -61,4 +61,7 @@ `git reset --soft HEAD` ## undo last commit (lose working tree) `git reset --hard HEAD^` ## ignore file `git update-index --assume-unchanged <file name>` -
ryuichi24 revised this gist
May 16, 2021 . 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 @@ -55,7 +55,7 @@ `git stash clear` ## undo a git push `git push -f origin HEAD^:main` ## undo last commit (preserves working tree) `git reset --soft HEAD` -
ryuichi24 revised this gist
May 16, 2021 . 1 changed file with 10 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 @@ -52,4 +52,13 @@ `git stash drop <stash name>` ## delete all stashed changes `git stash clear` ## undo a git push `git push -f origin HEAD^:master` ## undo last commit (preserves working tree) `git reset --soft HEAD` ## undo last commit (lose working tree) `git reset --hard HEAD^` -
ryuichi24 revised this gist
Jan 28, 2021 . 1 changed file with 22 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 @@ -31,4 +31,25 @@ `git fetch` ## restore working tree files in the current directory `git restore .` ## save the current changes in stash `git stash` || `git stash save "some comment to the changes"` ## display all stashed changes `git stash list` ## display changes of selected stash `git stash show -p <stash name>` ## apply stashed changes but keep the stashed `git stash apply <stash name>` ## apply stashed changes and delete the stashed `git stash pop <stash name>` ## delete selected stashed changes `git stash drop <stash name>` ## delete all stashed changes `git stash clear` -
ryuichi24 revised this gist
Jan 24, 2021 . 1 changed file with 4 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 @@ -28,4 +28,7 @@ `git checkout -b <new branch name>` ## update local repository with remote branch references `git fetch` ## restore working tree files in the current directory `git restore .` -
ryuichi24 revised this gist
Jan 22, 2021 . 1 changed file with 4 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 @@ -25,4 +25,7 @@ `git checkout <branch>` ## create a new branch and swich to it `git checkout -b <new branch name>` ## update local repository with remote branch references `git fetch` -
ryuichi24 created this gist
Jan 20, 2021 .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 @@ -0,0 +1,28 @@ # Git commands ## init local repository `git init` ## add changes to stage in the local `git add <files or directories>` ## add all changes in the local `git add .` ## commit changes to new commmit object being ready for remote repository `git commit -m "<comment>"` ## push the committed changes to the remote repository `git push <remote> <branch>` ## pull changes in the remote repository `git pull <remote> <branch>` ## list all branches `git branch` ## switch to the selected branch `git checkout <branch>` ## create a new branch and swich to it `git checkout -b <new branch name>`