Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why cannot a feature be finished with unstaged changes?

Is there a special reason why I cannot "finish a feature" (using git-flow) while my sandbox contains unstaged/non-commited changes?

like image 904
agfa555 Avatar asked Aug 14 '14 10:08

agfa555


People also ask

Can I rebase with unstaged changes?

You'll often want to do two things: change the commit message, or change the actual content of the commit by adding, removing and modifying files. error: cannot rebase: You have unstaged changes.

Can you git pull with unstaged changes?

Cannot pull with rebase: You have unstaged changes. Please commit or stash them. 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.

How do I delete unstaged files in git?

For all unstaged files in current working directory use: git restore . That together with git switch replaces the overloaded git checkout (see here), and thus removes the argument disambiguation. If a file has both staged and unstaged changes, only the unstaged changes shown in git diff are reverted.


1 Answers

Git cannot merge while you have non-committed changes.

You can do the following:

  • git stash to store your changes temporarily
  • finish your feature
  • git stash pop to get the stashed changes back on top of your current working directory
like image 51
Stephan Rodemeier Avatar answered Sep 21 '22 17:09

Stephan Rodemeier