How To Revert a Single File to a Specific Commit Using git

Author: , March 18th, 2019

git log {path_and_file} git checkout {commit_hash} — {path_and_file} git checkout 8c7eae3f518bb7fd98eb6e8344270f02065d83ee — myFile.txt

How To Revert All Changes in a git Branch

Author: , August 2nd, 2018

git checkout -f

How To Rename a Branch in Git Locally and Remotely

Author: , January 31st, 2018

Rename the old branch locally: git branch -m oldBranch newBranch Delete the old branch remotely: git push origin :oldBranch Push up the new branch, and make the local branch track with the new remote branch: git push –set-upstream origin newBranch

How to Manage Remote Branches in Git

Author: , October 19th, 2017

Git does not download all branches unless you tell it to. Until then, they are ‘remote’ branches. Use -r to list remote branches: git branch -r git fetch –all git pull –all If you see this error: fatal: The current branch CT-37 has no upstream branch. Push the current branch and set the remote as […]

How To Revert a Single File in Git to Match the Master Branch

Author: , October 19th, 2017

If you want to revert the file to its state in master: git checkout origin/master [filename]

How To Get a List of Changed Files in git

Author: , December 19th, 2016

To get just a list of files changed since the last commit: git diff –name-only To create a global alias called ‘git changed’: git config –global alias.changed ‘diff –name-only’

How To View the Current Settings for git remote

Author: , July 4th, 2013

1 2 cd {repository_directory} git remote -v show cd {repository_directory} git remote -v show

How To Reverse an Unwanted Merge in GIT

Author: , December 12th, 2012

git reset –hard

How To Compare Two Branches in GIT

Author: , December 10th, 2012

git diff branch1..branch2

How To Delete a Branch from a Remote Repo in GIT

Author: , November 21st, 2012

Do it locally: 1 git branch -d yourBranchName git branch -d yourBranchName Deleted branch yourBranchName (was 340c10d). Do it remotely, and please note the : below! (replace origin with your repo, if different) 1 git push origin :yourBranchName git push origin :yourBranchName To – [deleted] yourBranchName