custom pages

adunit2

adunit3

adunit4

Dec 25, 2012

How to view Staged and unstaged files in Git

In Git, Staging means what are the files you have changed those files are added by "git add ." (But not committed into git). simply we can tell "Changes that are staged but not committed".

Similarly in your branch you have changed few files but not yet staged using "git add ."  that means "changes that have not been staged".

git diff - will give you UNSTAGED files list and what are the changes you have done.

git diff -- staged command will give you what are the files and what are the changes on those files that you have staged using "git add" command.

Dec 24, 2012

How to name a stash in Git version control

This article shows the commands related into Git STASH.

git stash - command saves your local changes/uncommitted changes in your local. Stash command is not separate for one branch into other branch that means if you do git stash in master branch and git stash in enhancement(just branch name) branch is not different. If you do "git stash list " it will show all the branches stash list items.

you can see "wip in master,wip in enhancement". so stash is not branch specific.Its common for all branches.

git stash list - It will show you the list of recent stash available in your local git history.

git stash show - It will return recent stash items what are the changed files on the stash.

git stash save - You can give a stash name while you stash.

git stash apply - This command is very useful whenever you want to apply particular or named stash changes in your branch.

git stash apply stash@{3}- If you are planning to apply nth stash you can use for this example i have used for 3rd stash.

git stash show stash@{3}- Similarly you can use show command also. It will list the stashed file details and what are the changes that files had.

git stash drop stash@{3} - if you feel you have applied that 3rd stash no need to maintain hereafter that time you can use drop command. It will delete that stash from your  local git history.

git stash pop - command it will delete your last stored stash because stash generally acts like stack

git stash clear - command it will clear all your stored stash from your local git history.

How to use Regular expression in git stash
git stash save "first stash with description"

if you want to apply the above stash either you need to give the command like git stash apply "first stash with description" or another way is using regular expression like this

git stash apply stash^{/first} - This will apply the youngest stash that matches the regular expression "first". The funny thing is you no need to keep in mind with full stash name.