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 git.yourServer.com:/repos/yourProject.git – [deleted] yourBranchName

How To Find the Currently Checked Out GIT Branch

Author: , November 15th, 2012

git rev-parse –abbrev-ref HEAD

How To View the Latest GIT Log Entry

Author: , November 14th, 2012

git log -1 git log -1 –oneline git log -1 –pretty=%B

How To See The GIT History Of A File

Author: , January 30th, 2012

git log -p filename ~or~ git whatchanged -p filename