Search This Blog

Sunday, December 25, 2011

PostgreSql change password command line


Awww yeah... If we can't remember your postgres db password, we can reset it.

Ubuntu
First we have to switch to postgres user


su - postgres


now we can execute the psql command


psql -d dbname -U postgres; (this allows you to get it o the db)


alter user postgres with password 'newpassword'; (now you can modify the password)

Monday, December 5, 2011

Git Hub: Undo Commit and Push

Git Hub: Undo Commit and Push

Some times we commit undesirable changes to out local repository, and unfortunately on some rare occasions we actually push the undesirable change to remote repository( quick hands :) ). So we would need to undo the commit and push.
Scenario below has the following setup.

* Master branch, branch A, branch B.
* Both branch A and B came from master and they are focusing on totally different things. Neither of them are ready to be committed to master.

1) Mistake: branch B decides to commit to its remote repository but mistakenly committed to branch A's remote repository. Now Branch A is messed up and needs to be reverted.

solution:
step 1, checkout branch A locally.
step 2, revert local repository of branch A to the version right before the bad commit and push using the following command.

git reset --hard 9ab122edde

this tag 9ab122edde refers to the hash of the version right before the commit. every commit has one, so no need for me to go about where to find this guy.

step 3, now the local repository of branch A is back to normal and we should push it to its remote repository.

git push origin +branchA

Done!

PS .... to remove a remote branch, do the following.

git push origin :branchName