git diff origin/master
git diff master..Prod -- web\en-US\docs\faq.txt
git push --dry-run
git push origin <tag_name>
git push origin --delete <tagname>
git tag -d <local tagname>
git tag -d release/aug2002
git branch --set-upstream-to=origin/master
git restore hello.c
git remote rm origin
#how to add existing git folder to remote
git remote add origin <REMOTE_URL>
git checkout -b subbranch_of_b1 branch1
git clean -df
git checkout -- .
git reset --hard HEAD~ # if you accidently push your commit to another branch (not current) and don't want to keep it
git pull origin Prod-OS # then you need to fetch head (pull branch explicitly)
git remote show origin
git rebase origin/develop
git rebase --continue
git rebase --abort
git add/rm <conflicted_files>
#if you get this message - "Your branch and 'origin/develop' have diverged"
git fetch --all
git branch backup-develop
git reset --hard origin/develop
git pull
#if you have local changes when switching branches
git stash mycurrentBranch
git checkout -f anotherBranch
#how to delete a remote branch called "fun_feature"
git checkout master
git branch -d fun_feature
#Delete a remote branch
git push origin --delete remoteBranchName
git branch --all
#undo last commit and don't want to save it for future use
git reset --hard HEAD~1
#revert commit on featured branch and merge with current develop branch
#On branch feature/googleTagManager
git revert --no-commit c99f68fb
git merge develop
#revert most recent commit
git revert c99f68fb..HEAD
git commit
#Always checkout single file from origin to avoid getting old version
#Remember to pull first!!!
git pull
git checkout origin/master web\en-US\docs\faq.txt
#Reset local files to match the remote branch
git reset --hard origin/phobos
#how to find the date a commit is done
git show -s --format=%ci <commit>
#if you get SSL local certificate error, run this:
git config --global http.sslbackend schannel
#stash
git stash
git stash list
git stash apply
#how to delete remote and local branch
git push -d <remote_name> <branchname>
git branch -d <branchname>
#If your editor can exit with an error code -- Git will abort the commit. When using VIM, type
:cq
#to exit with an non-zero error code and abort the commit.
#How to override last local commit message
git commit --amend -m "DCPE-2773"
#How to reset token - Encode your Email Address: • user@example.com becomes user%40exam
git remote set-url origin https://<your_encoded_email>:<your_token>@gitlab.com/<username>/<repository>.git
#If you found your local branch is clean but is not matching remote
git branch --set-upstream-to=origin/mergeMain mergeMain
#if your local branch and remote branch are diverged, you can reset it to remote (do not rebase)
git reset --hard origin/<branch-name>
#Remove untracked files and directories:
git clean -fd
#User token to clone (here my user id is 75xxxxx)
git clone https://userid:token@gitlab.com/username/repo.git
#How to revert auto-merge when you are using the git merge command
git reset --soft HEAD~1
#How to include token in pull
git remote set-url origin https://<YOUR_GITHUB_USERNAME>:YOUR_PERSONAL_ACCESS_TOKEN>@github.com/<YOUR_REPO>.git
#If you're doing a merge and found conflicts
#You can override the file that has conflicts with either in the current branch (ours) or the incoming branch (theirs)
git checkout --ours <file>
git checkout --theirs <file>
#How to get back the file you deleted but haven't pushed to remote yet
#Find the commit before you delete your file and then check it out
git log -- path/to/your/file
git checkout <commit-hash> -- path/to/your/file
#I tried to commit a change but I was using another account so it failed.
#Need to update the configured email:
git config user.email "YOUR_EMAIL"
#How to find a corresponding commit of Prod on a dev branch
#On prod branch and the exact commit, run the following and you'll get the commit
git merge-base prod dev
#How to rollback to a previous commit, make change to it, and push it to override master
git push origin HEAD:master --force
-
Archives
- December 2025
- August 2025
- May 2025
- April 2025
- March 2025
- March 2024
- October 2023
- August 2023
- July 2023
- April 2023
- January 2023
- December 2022
- May 2022
- April 2022
- March 2022
- October 2021
- August 2021
- July 2021
- June 2021
- April 2021
- March 2021
- February 2021
- January 2021
- December 2020
- February 2020
- December 2019
- October 2019
- August 2019
- July 2019
- June 2019
- May 2019
- April 2019
- March 2019
- February 2019
- January 2019
- October 2018
- September 2018
- August 2018
- May 2018
- April 2018
- February 2018
- January 2018
- November 2017
- October 2017
- September 2017
- August 2017
- June 2017
- May 2017
- April 2017
- March 2017
- January 2017
- November 2016
- September 2016
- August 2016
- July 2016
- June 2016
- April 2016
- March 2016
- January 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- December 2014
- September 2014
- August 2014
- July 2014
- May 2014
- April 2014
- March 2014
- February 2014
- January 2014
- December 2013
- October 2013
- July 2013
- June 2013
- May 2013
- April 2013
- March 2013
- February 2013
- January 2013
- December 2012
- November 2012
- October 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
-
Meta