Back to Top

Solution:Cannot pull with rebase: You have unstaged changes in Github

GIT – CANNOT PULL WITH REBASE: YOU HAVE UNSTAGED CHANGES

Git has a number of good features designed to improve user experience with Github and reduce the chances of data loss. Earlier I have explained about Solution: Github ‘Please tell me who you are’ error. Today I am going to explain about the common message which you might get when executing pull command.

Recently I was trying to run git pull –rebase command but I got message like

Git stash command is kind of commit stored changes to temporary space and clean working copy. Then your working copy will be reverted to HEAD.It is a good place to store uncommitted changes.

When you stash the changes, your changes will be stored in temporary space and your working copy will be reverted to HEAD

git pull –rebase is a good practice to use in general.This is very specific problem when you pull data from server so let’s check it with example

You have changes that have not been committed and you are going to pull changes from the server, you will get above error.This error says commit your local changes before you pull or stash changes mean store local changes to another place for temporary and get back with pop.

You can do this to work around using following steps

1. stash your changes with: git stash
2. pull from master with rebase: git pull –rebase
3. Then execute simpler git stash pop. With this command, it deletes that stash for good, while apply does not.

Here I have used git stash pop but After changes have been stashed, there are a few options of to get changes back to local:

1. git stash pop: This command takes a stashed change and removes changes from the stash stack and apply it to your current working tree.

2. git stash applies : This command takes a stashed change and applies it to your current working tree. You need to delete stash stack using git stash drop .

3. git stash branch: This command creates a new branch from the same commit you were on when you stashed the changes and applies the stashed changes to the new branch.

Experiment with the stash before using it on some really important work 🙂

Comments (1)

  1. why not emerge HEAD with working files, like svn’s .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

What is JavaScript Hoisting

Posted on 9 years ago

Bhumi

Event Delegation in jQuery

Posted on 9 years ago

Bhumi

How to change Base Path in Typo3

Posted on 12 years ago

Bhumi

Newly Approved Joomla Module

Posted on 11 years ago

Bhumi