Wednesday, 27 September 2017

Basics of Git Version Control

Git is a version control software used to manage objects. These objects can be anything from code in any language, to image, to text files. git stores all this information in 'repository'. Git is free and open source. Git is very powerful and easy to learn and use.

Installation : Git

Basic Commands:
Here are some basic git commands which can be helpful from time to time for a newbie or noob.

git init - To create and initialise repository in the current local path/folder
              After issuing this command, it creates a hidden .git folder to store all the information

git status - Once you create some objects in the local repository, this status command can help to track the changes in object.

git add <ObjectName> - This is used to add an object to staging, which basically means it is ready to be pushed to remote repository. You can use 'git add .' to stage all the objects in the path. You can also use wildcard characters here. If you don't want certain files to be tracked. You can create a .gitignore file and specify the details there.

git commit - m "<Your Commit Message>" - This is used to commit the changes

git log - Shows commit history with basic details

git branch <BranchName> - To create new branch. Branches are used when you want to do the change without impact the original file. The name of main branch is 'master'.

git checkout <BranchName> - To switch to a branch.

git branch -d <BranchName> - To delete branch.

git diff <SourceBranch> <TargetBranch> - shows difference between source and target branch.

git merge <BranchName> - First switch to master branch. Then issue this command so that all the changes done in <BranchName> will be merged with master.  When changes conflicts between master and <BranchName> occurs, git informs and puts the changes in the object.

git remote - shows existing remote repositories

git remote - v - shows existing repositories with URL.

git clone <RemoteRepositoryURL> - This will pull all the data from remote repository into local folder. Origin is an alias name of the repository cloned.

git fetch origin - This will fetch if any extra changes from remote repository to local. But it doesn't merge the changes.

git pull origin - It fetches if any extra changes from remote repository to local repository and merges the changes from remote branch to current branch.

git push origin master - This command is issued after all the needed changes are committed to finally submit changes to remote repository origin.

git remote add <Alias> <URL> - to add remote repositories.


I found a very nice explanation about git here.  My git repository is here.









Tuesday, 26 September 2017

Investment - Personal Finance

I always wanted to talk about personal finance. This is something I developed deep interest after being educated from a fellow colleague few years back in the memory lane. That realisation will probably never leave me.

I believe on the principle that money is a need in life but life has more to it. I'd advise to pay attention to this subject and establish a good discipline and awareness in the early years of your job.

Invest in yourself. Be confident, try things and fail, until you discover your passion. And you will see, along the journey you would start making money. Keep also your health in your priority list.

Build a conservative approach of spending what is left after saving. In the long run, this will pay off better. Remember the earlier you start, the better it is, relying on the magic of compounding.

There are multiple options to Invest like Bank FD's, Savings Account, Gold ETF, Bonds, Stocks, Mutual Funds, Tax saving instruments like PPF, NPS etc

If you are a salaried employee, the first step should be to start saving from the early years of your career and build an emergency fund. This amount should always be liquid, so should be kept in savings account or flexible sweep-in FD's. You should have a minimum of 6 months of your living expenses in your emergency fund.

Next, educate yourself to invest in mutual funds or directly in stocks. This is necessary to beat inflation, as investment in mere Bank FD's cannot cope up with time value of money. Start with less money, you will make mistakes no doubt, but learn from them to move on. Over the long run, you would have made your money grow better than it would be in Bank Savings or FD. Never invest aggressively in Equity, never try to time the market.

Invest some part of your savings into Bank RD or FD. For a young salaried employee, this could be a small portion here and more into stocks. As you grow older, you should increase your savings portion in FD's and reduce in Equity. This is to ensure that your capital is safe.

Invest in tax saving schemes like PPF or NPS to avail tax benefits. I'd advise to open PPF account from the first year of your career,  due to a lock in period of 15 years.

Once you have saved a good amount of money, try and invest in real estate. Real estate investments are more conservative but requires a huge capital.

All the best. The key is to start early and remain disciplined.

What good is an investment if it doesn't let you sleep at night ? Always remember to smile, be generous and enjoy your life.


This post is a maiden attempt to thank my mentor (Sapan Gupta), a many hundred times for providing the spark and encouragement in the field of Personal finance.



Saturday, 2 September 2017

Statically typed vs Dynamically typed Languages

Statically typed or dynamically typed are basically features of the programming language.

A statically typed language checks for type checking at compile time, whereas in the dynamically typed language the type checking is done at run time.

Some statically typed languages are C, C++, Java etc, whereas Python, Ruby and Perl are dynamically typed languages.

In statically typed languages, bugs due to variable type declaration can be detected earlier at compile time. Whereas in dynamically typed language, these bugs are only detected at run time.

For example if you try and add a string to a number  in C++, the program wouldn't compile and throw error upfront

'2' + 7  would throw error at compile time in C, C++ or Java

Whereas in Python the same code doesn't throw error until and unless run time execution has reached that particular piece of code in question.