Monday, June 29, 2015

Combine 2 commits into one and update pull request

Finally, I was able to combine 2 commits into 1 commit and update the pull request. This will save me lots of time instead of creating a new pull request everytime and re-do work.

First time:
git clone <my-clone-of-upstream-repo>
cd <upstream-repo>
git remote add upstream <upstream-repo>
git config --global push.default simple
When starting a new pull request:
git checkout -b <new-branch>
Make changes, commit and send pull request. 

When combining n commits:
git fetch upstream
git merge-base new-branch master => This will generate a commit hash
git rebase --interactive <commit hash>
Your text editor will open with a file that lists all the commits in new-branch, and in front of each commit is the word "pick". For every line except the first, you want to replace the word "pick" with the word "squash" or "fixup". Save this file. 
git rebase upstream/master
git push -f

Thursday, June 11, 2015

Start vim without .vim settings

In my .vim settings, I have audo indent and smart indent enabled. Sometimes when I'm copying code, this causes the code to completely go wonky.

So, to avoid this and just copy the code, I disable the vim settings and open the file using
vim -u NONE filename
 

Wednesday, May 27, 2015

Restarting gnome-shell

Often, my desktop will get stuck into a weird position - particularly when I plug in and out of my dock (multi-monitors). Restarting gnome-shell fixes the problem.

You can restart the gnome-shell by pressing Alt+F2 and then typing in either "restart" or just "r" and pressing enter

Tuesday, April 28, 2015

Commenting a block of code in vi

Many times, when modifying code or debugging, I comment out blocks of code. This is tedious to do manually.

I searched around for a way to do it fast and came across this tip:

For commenting a block of text is almost the same: First, go to the first line you want to comment, press CtrlV, and select until the last line. Second, press ShiftI#Esc (then give it a second), and it will insert a # character on all selected lines. For the stripped-down version of vim shipped with debian/ubuntu by default, type : s/^/# in the second step instead.

Thursday, April 16, 2015

Use a specific repo for installing a package

I was facing an issue at work today where I needed to install a package from a repo. The repo for that package had been created in yum. However, one of the other repos had an issue where the url for that repo was not reachable and this caused "yum install" to fail for me constantly. 

 So I wanted to a way to install my package from a particular repo and not involve any other repo. The only way I found to do this is to disable all other repos and enable only the repo I want and install the package from it. 

To do that:

yum --disablerepo="*" --enablerepo="reponame" install pkgName

You can substitute reponame and pkgName with the names of the actual repo you want to use and package you want to install.

Wednesday, April 15, 2015

Syncing a fork of github

I use github for my work and have a fork of some repositories. When I send a pull request, often I have issues with my fork being out of sync with the main repository.

Today, I synced up my fork without any issues. Here's how I did it.

Go to folder which contains the clone of of your fork.

git remote add upstream https://github.com/upstreamreponame/repo.git
git fetch upstream
git checkout master (to make sure you're on master)

If you want to make sure these changes don't show up as a checkin on ur fork:

git merge upstream/master

This worked great for me!


References:
Syncing a fork
How to update GitHub forked respository
Updating a fork directly from github

Tuesday, April 14, 2015

Welcome to my blog!

Hi!

I'm a QA Engineer and a tech nerd. I love testing and automation. I love my Mac and my iPhone. I love checking out new websites and apps.

I like learning new things everyday and would love to share what I learn every day.

Hope to see you all around!