Github Revisited

Today, I learned how to change default category.

As, I always forgot to change category and someone point me everytime. So, I decided to take some action upon it. I changed my default category to “Daily Diary”.

Go to settings -> Writings -> Default Category

Now moving to the Github.

Today, I will discuss with about git pull command and merge conflicts.

The task done by git fetch followed by git merge  together is equal to the task done by git pull alone in the current directory.

git pull command basically fetch and merge the changes done in the remote repo to the local repo.

git pull

Now the other thing I am going to explain is how to add a push a directory into the remote account.

First make a new directory into the your local repo and then write

git add a/.

git commit -m "new directory"

git push -u origin master


Make sure before pushing a new or exiting directory to your remote repo “mirrioring” should be done means before pushing remote repo and local repo should be up to date.

git remote add amisha

git pull amisha/master

git merge amisha/master

but there was merge conflicts. So to check the conflicts or differences in the file type “git diff” and you will the conflicts. Now open the file in your favourite editor and resolve the conflicts and the file and again try to merge.

We should use git merge command when we are on other branch.




Now, we will discuss about the command git stash.

The problem is, you don’t want to do a commit of half-done work just so you can get back to this point later and you want to switch other branches . The answer to this issue is the git stash command.

If you run git status, you can see your dirty state (in my case).

Dirty state means that there are modified files  in your branch which has not been committed yet.


git revert

This command creates a new commit that undoes the changes from a previous commit. This command adds new history to the project (it doesn’t modify existing history).

If a commit has been made somewhere in the project’s history, and you later decide that the commit is wrong and should not have been done, then git revert is the tool for the job. It will undo the changes introduced by the bad commit, recording the “undo” in the history.

git reset

This command is a little more complicated. It actually does a couple of different things depending on how it is invoked. It modifies the index (the so-called “staging area”). Or it changes which commit a branch head is currently pointing at. This command may alter existing history (by changing the commit that a branch references)

If you have made a commit, but haven’t shared it with anyone else and you decide you don’t want it, then you can use git reset to rewrite the history so that it looks as though you never made that commit.







Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s