git uncommit last commit but keep changes 1

git uncommit last commit but keep changes

# Revert changes to modified files.
git reset --hard

# Remove all untracked files and directories.
# '-f' is force, '-d' is remove directories.
git clean -fd

Here is what the above code is Doing:
1. git fetch –all
– This will fetch all the remote branches and tags.
2. git reset –hard origin/master
– This will reset the local master branch to the remote master branch.
3. git clean -fd
– This will remove all untracked files and directories.

Similar Posts