Last active
December 2, 2023 09:33
-
-
Save abbas-v1/bfc9dcc7ab352b496cd2a4816b501811 to your computer and use it in GitHub Desktop.
Revisions
-
Abbas Muhammad revised this gist
Dec 2, 2023 . 1 changed file with 6 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 @@ -128,6 +128,11 @@ git fetch --all Then is possible to merge another branch from the new remote to your current one. git merge template/main --allow-unrelated-histories Rebase your branch to master branch git rebase master git push --force origin your_branch_name If you have a branch A from master and then another branch B from A and want to connect B to master git checkout B git rebase A --onto master git push --force origin B -
Abbas Muhammad revised this gist
Jul 28, 2023 . 1 changed file with 5 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 @@ -126,4 +126,8 @@ Then run git fetch to update the changes git fetch --all Then is possible to merge another branch from the new remote to your current one. git merge template/main --allow-unrelated-histories Rebase your branch to current master branch git rebase master git push --force origin your_branch_name -
abbas-v1 revised this gist
Apr 1, 2022 . 1 changed file with 13 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 @@ -15,6 +15,7 @@ git branch -a List all tags ``` git tag -l ``` @@ -114,4 +115,15 @@ for commit in $(git log --reverse --pretty=%H --since="2021-05-27T17:19:00" --un do git cherry-pick $commit done ``` Get changes from GitHub template On the other repositories you have to add this template repository as a remote. git remote add template https://github.com/bit-oasis/template-service.git Then run git fetch to update the changes git fetch --all Then is possible to merge another branch from the new remote to your current one. git merge template/main --allow-unrelated-histories -
abbas-v1 revised this gist
May 30, 2021 . No changes.There are no files selected for viewing
-
abbas-v1 revised this gist
May 30, 2021 . 1 changed file with 8 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 @@ -106,4 +106,12 @@ git clean -f -d Files changed in this branch ``` git diff master.. --name-only ``` Cherry-pick commits from one branch into another ``` for commit in $(git log --reverse --pretty=%H --since="2021-05-27T17:19:00" --until="2021-05-30T12:03:00" --all); do git cherry-pick $commit done ``` -
abbas-v1 revised this gist
Sep 18, 2019 . 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 @@ -92,13 +92,13 @@ Reset local branch to previous commit git reset --hard e3f1e37 ``` Hard reset remote branch to previous commit ``` git reset --hard e3f1e37 git push --force origin develop ``` Hard reset to clean untracked files and directories ``` git clean -f -d ``` -
abbas-v1 revised this gist
Sep 18, 2019 . 1 changed file with 11 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 @@ -87,6 +87,17 @@ Completely undo it, throwing away all uncommitted changes, resetting everything git reset --hard HEAD^ ``` Reset local branch to previous commit ``` git reset --hard e3f1e37 ``` Reset remote branch to previous commit ``` git reset --hard e3f1e37 git push --force origin develop ``` Reset to clean untracked files and directories ``` git clean -f -d -
abbas-v1 renamed this gist
May 8, 2019 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
abbas-v1 revised this gist
Feb 25, 2019 . 1 changed file with 5 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 @@ -87,6 +87,11 @@ Completely undo it, throwing away all uncommitted changes, resetting everything git reset --hard HEAD^ ``` Reset to clean untracked files and directories ``` git clean -f -d ``` Files changed in this branch ``` git diff master.. --name-only -
abbas-v1 revised this gist
Feb 25, 2019 . 1 changed file with 5 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 @@ -85,4 +85,9 @@ git reset HEAD^ Completely undo it, throwing away all uncommitted changes, resetting everything to the previous commit ``` git reset --hard HEAD^ ``` Files changed in this branch ``` git diff master.. --name-only ``` -
abbas-v1 revised this gist
Feb 25, 2019 . 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 @@ -18,11 +18,13 @@ List all tags git tag -l ``` Checkout a specific branch, tag, revision, file or a directory ``` git checkout <branch_name> git checkout tags/<tag_name> git checkout <revision_sha> git checkout origin/master -- <filename> git checkout origin/master -- </directory/path/> ``` Stashing changes -
abbas-v1 revised this gist
May 4, 2017 . 1 changed file with 12 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 @@ -58,6 +58,18 @@ Resolve merge conflicts git mergetool ``` If already in conflict state, and want to accept all of theirs ``` git checkout --theirs . git add . ``` If already in conflict state, and want to accept all of ours ``` git checkout --ours . git add . ``` Undo the act of committing, leaving everything else intact ``` git reset --soft HEAD^ -
abbas-v1 revised this gist
Oct 15, 2016 . 1 changed file with 0 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 @@ -71,9 +71,4 @@ git reset HEAD^ Completely undo it, throwing away all uncommitted changes, resetting everything to the previous commit ``` git reset --hard HEAD^ ``` -
abbas-v1 revised this gist
Oct 15, 2016 . 1 changed file with 30 additions and 32 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,26 +1,8 @@ Clone a remote repository on your local machine ``` git clone <repository_url> ``` List all local branches ``` git branch @@ -40,37 +22,53 @@ Checkout a specific branch, tag or revision ``` git checkout <branch_name> git checkout tags/<tag_name> git checkout <revision_sha> ``` Stashing changes ``` git stash list git stash git stash pop git stash drop ``` Ignore changes in a file that is currently being tracked ``` git update-index --assume-unchanged <file_name> ``` Start tracking changes in a file that has been previously ignored ``` git update-index --no-assume-unchanged <filen_name> ``` Revert changes made in a previous commit ``` git revert <revision_sha> ``` Show change history of a file ``` gitk <file_path> ``` Resolve merge conflicts ``` git mergetool ``` Undo the act of committing, leaving everything else intact ``` git reset --soft HEAD^ ``` Undo the act of committing and everything you'd staged, but leave the work tree (your files intact) ``` git reset HEAD^ ``` Completely undo it, throwing away all uncommitted changes, resetting everything to the previous commit ``` git reset --hard HEAD^ ``` -
abbas-v1 revised this gist
Oct 15, 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 @@ -1 +0,0 @@ -
abbas-v1 renamed this gist
Oct 15, 2016 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
abbas-v1 revised this gist
Oct 15, 2016 . 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 @@ -0,0 +1 @@ I like it **this** way. -
abbas-v1 revised this gist
Oct 15, 2016 . 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 @@ -1,8 +1,8 @@ # gitCommands Go to the directory **where** you want to clone the repo ``` git clone repository_URL ``` To ignore a tracked file -
abbas-v1 revised this gist
Oct 15, 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 @@ -2,7 +2,7 @@ Go to the directory where you want to clone the repo ``` 'git **clone** repository_URL' ``` To ignore a tracked file -
abbas-v1 revised this gist
Oct 15, 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 @@ -2,7 +2,7 @@ Go to the directory where you want to clone the repo ``` 'git clone repository_URL' ``` To ignore a tracked file -
abbas-v1 revised this gist
Oct 15, 2016 . No changes.There are no files selected for viewing
-
abbas-v1 created this gist
Oct 15, 2016 .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,81 @@ # gitCommands Go to the directory where you want to clone the repo ``` git clone repository_URL ``` To ignore a tracked file ``` git update-index --assume-unchanged <file> ``` To start tracking changes again ``` git update-index --no-assume-unchanged <file> ``` To revert changes made in a previous commit ``` git revert dd61ab32 ``` note: for a small message [ -m "sldfkjs dflskdifs" ] List all local branches ``` git branch ``` List all local and remote branches ``` git branch -a ``` List all tags ``` git tag -l ``` Checkout a specific branch, tag or revision ``` git checkout <branch_name> git checkout tags/<tag_name> git checkout <sha_of_revision> ``` Show the change history of a file ``` gitk [fileNamWithPath] ``` To merge conflicts. Commit your local changes without pushing and git a pull. Then ``` git mergetool ``` Stashing changes ``` git stash list git stash git stash pop ``` If all you want to do is undo the act of committing, leaving everything else intact, use: ``` git reset --soft HEAD^ ``` If you want to undo the act of committing and everything you'd staged, but leave the work tree (your files intact): ``` git reset HEAD^ ``` If you actually want to completely undo it, throwing away all uncommitted changes, resetting everything to the previous commit (as the original question asked): ``` git reset --hard HEAD^ ``` SVN difference ``` svn diff -r 13:17 > review.patch ```