How To Show Filenames With git log

Author: , June 3rd, 2019

To display the filenames included in each commit, just add the –name-only argument to git log:

How To Remove A File From The git Staging Pre-Commit List

Author: , May 31st, 2019

Quickref: How to Remove a file from the staging area

The Story Recently, I accidentally added some files to git’s pre-commit phase, i.e.:

For example, here is how to handle the above situation:

To better understand, here are the phases/states/stages that git uses: Untracked – when a file is first created, git […]

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

How To Reverse an Unwanted Merge in GIT

Author: , December 12th, 2012

git reset –hard