Last active
August 29, 2015 14:01
-
-
Save BalajiIyengar/fbb48dc07629f59ddd70 to your computer and use it in GitHub Desktop.
Git Commands (Practicals)
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 characters
Files in A Commit | |
git show --pretty="format:" --name-only commitRSA (To see th list of files in the commit) | |
git ls-tree --name-only -r <commit-ish> (Files in a commit) | |
git diff HEAD~1 --name-only | |
Removing Files From a Commit | |
git reset --soft HEAD~1(could be Head~2 in case you've resolved conflicts or are in between merge) | |
Seeing the Staged Area( post git add) | |
git diff --staged --name-only | |
List of Changed Files | |
git diff-tree --no-commit-id --name-only -r <commit-ish> (List of Changed Files) | |
Unstaging a File | |
git reset fileName | |
Unstaging the entire staging | |
git reset | |
Unstaging and Getting the workspace to the previous level | |
git reset --hard | |
Undo a Revert | |
git reset --hard HEAD~ | |
HEAD~ means the commit before the current HEAD | |
Like git reset is for staged files,git clean is for untracked files | |
for viewing list of untracked files that could be deleted | |
git clean -n | |
for removing the untracked files(operation cant be undone later) | |
git clean -f | |
Updating a new branch to the latest code of the main or any other brnach | |
git rebase theMainBranchName. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment