Wednesday, March 8, 2017

AWS

EC2:
Login:
1. Copy your .pem file to ~/.ssh.
2. Change permissions to chmod 500 <your_file>.pem
3. Login to your server.

ssh -i /full-path-to/.pem ec2-user@PUBLIC_DNS


INSTALL PHP:
sudo yum install php56

Free Memory Check:
free -m (in MB)

Hard disk capacity Check:
df -h (Human Readable)

GIT Resets


GIT REST HELP
  • Soft
    • git reset --soft <commit id>
  • Mixed
    • git reset --mixed <commit id>
  • Hard
    • git reset --hard <commit id>

Check git log status:
git log --oneline

Soft:
git reset --soft <commit id>

Result:
Brings the files changed after this commit id into staging index. 
i.e, as if those changed files were added using git add command.

Mixed:
git reset --mixed <commit id>

Result:
Brings the files changed after this commit id into Working Directory. 
i.e, as if those changed files were changed but not gone through git add yet.

Hard:
git reset --hard <commit id>

This is the most dangerous command as it is going to completely wipe out our working directory and staging index. Any files you were tinkering with will be gone.

Result:
Brings the files changed after this commit id into staging index. 
i.e, as if those changed files were added using git add command.


git reset --hard HEAD
This will bring your code base to the commit where HEAD is pointing to.
Basically this will wipe out any changes in Working Directory and Staging Index.


TODO:
Pushing reset commit to remote?