How to get back your git commits after somebody ate them

You do a git pull and you find that someone has undone all the changes you’ve made today. To restore your commits, you’ll need to create a branch, checkout your commit you want to restore, and merge your branch into master (or whatever branch you want to restore to).

git checkout -b newBranch
git checkout 459a100 .
git diff --name-only master
git add .
git status
git commit -m 'restore commits after funky merge'
git checkout master
git pull
git merge newBranch

Hopefully there will be no merge conflicts. If so, you’ll need to sort those out before you can push. Also, some people will tell you rebase instead. However, this works for me. YMMV.




How to debug anything

http://www.slideshare.net/jamesgolick/how-to-debug-anything




Use FPM to create java jdk RPM package

Creating packages from redhat or debian systems can be a royal pain. FPM takes some of the pain away. Refer to the FPM wiki for install and usage instructions.

To create an RPM for Oracle’s (sun) java jdk 7:

  1. Download jdk7 from Oracle site. (example, jdk1.7.0_65)
  2. untar into /opt folder, (result: /opt/jdk1.7.0_65)
  3. create alternatives.sh script in the exploded folder
  4. create uninstall.sh script in the same location
  5. run fpm command
  6. (recommended) upload rpm to your custom yum repo

#alternatives.sh
#!/bin/bash
alternatives --install /usr/bin/java java /opt/jdk1.7.0_65/bin/java 1

#uninstall.sh
#!/bin/bash
alternatives --remove java /opt/jdk1.7.0_65/bin/java
rm -rf /opt/jdk1.7.0_65

Run the fpm command to generate an rpm
fpm -s dir -t rpm --after-install /opt/jdk1.7.0_65/alternatives.sh --after-remove /opt/jdk1.7.0_65/uninstall.sh --name jdk7 -v 1.7.0.65 /opt/jdk1.7.0_65