Git – How to undo ‘git add’ before commit

To undo git add before git commit, do this git reset <file> In addition to afore-mentioned example, we can undo staging all files, without any file name. This is useful when there are too many files to be listed one by one in a reasonable amount of time. git reset

Git – How to Delete Local and Remote Branch

Delete a local branch A local branch is a branch which is the one inside the computer. To delete a local branch, execute following git command. Replace the branch_name with the one that you want to remove in your local computer. git branch -d branch_name To force delete a local branch, replace -d with -D,... » read more

Git – How to Undo the Last Commit

Heads up! This example is based on a git repository which has at least 2 commits already. Only start to git reset from the second commit & on-wards. Committed wrong files and haven’t pushed the commit to remote server, if you wish to undo it, it can be done. git commit -m "Committed wrong files"... » read more