Undo git stash pop that results in merge conflict

As it turns out, Git is smart enough not to drop a stash if it doesn’t apply cleanly. I was able to get to the desired state with the following steps: To unstage the merge conflicts: git reset HEAD . (note the trailing dot) To save the conflicted merge (just in case): git stash To return to master: git … Read more

How to git add a whole folder

My guess is that you are trying to add folder while you already are in folder. Instead, add everything in the folder, rather than the folder itself: To your other question, adding whole folders is fine, but only relevant when adding sub-folders. Again, you can’t git add the folder that is your repository (my_folder above). The usual way to add everything in … Read more

Undo a git stash

You can just run: and it will unstash your changes. If you want to preserve the state of files (staged vs. working), use

Git pull origin overwrites master?

If you do a git pull with a remote branch name, it will fetch the remote branch and then merge it into your current local branch. So to undo that, you will first have to reset your local branch to the remote master, then create a new local vs12up branch from the corresponding remote branch. Reset your local master to match the … Read more

How to “git clone” including submodules?

With version 2.13 of Git and later, –recurse-submodules can be used instead of –recursive: Editor’s note: -j8 is an optional performance optimization that became available in version 2.8, and fetches up to 8 submodules at a time in parallel — see man git-clone. With version 1.9 of Git up until version 2.12 (-j flag only available in version 2.8+): With version 1.6.5 … Read more