diff --git a/src/plugins/git/branchdialog.cpp b/src/plugins/git/branchdialog.cpp
index e017b39889ad27eab9def891849c03e35b3b8b79..d6f7bc209652a257f9c1542a356ad30fe0016c7b 100644
--- a/src/plugins/git/branchdialog.cpp
+++ b/src/plugins/git/branchdialog.cpp
@@ -261,8 +261,8 @@ void BranchDialog::merge()
     if (gitClient->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules)) == GitClient::StatusChanged)
         gitClient->ensureStash(m_repository, QLatin1String("merge"), false, &stashMessage);
 
-    if (gitClient->synchronousMerge(m_repository, branch) && (!stashMessage.isEmpty()))
-        gitClient->stashPop(m_repository);
+    if (gitClient->synchronousMerge(m_repository, branch) && !stashMessage.isEmpty())
+        gitClient->stashPop(m_repository, stashMessage);
 }
 
 void BranchDialog::rebase()
@@ -278,8 +278,8 @@ void BranchDialog::rebase()
     if (gitClient->gitStatus(m_repository, StatusMode(NoUntracked | NoSubmodules)) == GitClient::StatusChanged)
         gitClient->ensureStash(m_repository, QLatin1String("rebase"), false, &stashMessage);
 
-    if (gitClient->synchronousRebase(m_repository, baseBranch) && (!stashMessage.isEmpty()))
-        gitClient->stashPop(m_repository);
+    if (gitClient->synchronousRebase(m_repository, baseBranch) && !stashMessage.isEmpty())
+        gitClient->stashPop(m_repository, stashMessage);
 }
 
 void BranchDialog::changeEvent(QEvent *e)
diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index f1418121a6f4a9d979d577f951c4a0649a90dbc7..1a82c4c4a7bb8c8bda9b453ddeb909f95cb25f02 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -2277,14 +2277,21 @@ QString GitClient::msgNoChangedFiles()
     return tr("There are no modified files.");
 }
 
-void GitClient::stashPop(const QString &workingDirectory)
+void GitClient::stashPop(const QString &workingDirectory, const QString &stash)
 {
     QStringList arguments(QLatin1String("stash"));
     arguments << QLatin1String("pop");
+    if (!stash.isEmpty())
+        arguments << stash;
     VcsBase::Command *cmd = executeGit(workingDirectory, arguments, 0, true);
     connectRepositoryChanged(workingDirectory, cmd);
 }
 
+void GitClient::stashPop(const QString &workingDirectory)
+{
+    stashPop(workingDirectory, QString());
+}
+
 bool GitClient::synchronousStashRestore(const QString &workingDirectory,
                                         const QString &stash,
                                         bool pop,
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 9b002c683badad922e216f0ad90dbeae814ab281..9e2469c5c62f66cca0d28daedfc2a610ba21e4f1 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -193,6 +193,7 @@ public:
     void synchronousSubversionFetch(const QString &workingDirectory);
     void subversionLog(const QString &workingDirectory);
 
+    void stashPop(const QString &workingDirectory, const QString &stash);
     void stashPop(const QString &workingDirectory);
     void revert(const QStringList &files, bool revertStaging);
     void branchList(const QString &workingDirectory);