Posted in GIT

GIT : Clone repository to the existing directory

After resetting my laptop, I just had the code backup. unfortunately.git folder got removed while copying data. Cloning the repository again sounded bad for me due to its size and the poor intermittent network connectivity. Cloning of the repository failed multiple times. This might be a situation you might be undergoing. Here is the way I did to clone the repository to existing directory with all the remote data.

This can be done for:

  1. Linking the local directory with data and remote git repository WITH data
  2. Linking the local directory with data and remote git repository WITHOUT data
Continue reading “GIT : Clone repository to the existing directory”
Posted in GIT

Git revert back to older commit

You have multiple commits in a branch but all gone wrong somehow and now you want to revert back to a specific commit. This is how you do:

Situation 1: Reverting to older commit

Danger Alert: All your uncommitted changes will be lost doing this. If you have such, prefer next situation.

git reset --hard <commit_code>
git commit -m "Reverted to <commit_code>"

Replace <commit_code> with your commit SHA Eg. 9acbb770

Continue reading “Git revert back to older commit”