Skip to content

Instantly share code, notes, and snippets.

@SgtPooki
Created July 3, 2014 12:08
Show Gist options
  • Save SgtPooki/10efd02b066a8704b776 to your computer and use it in GitHub Desktop.
Save SgtPooki/10efd02b066a8704b776 to your computer and use it in GitHub Desktop.
stash conflict example
07:01:38 /var/projects
$ mkdir gitStashConflictExample
07:01:53 /var/projects
$ cd gitStashConflictExample/
07:01:55 /var/projects/gitStashConflictExample
$ git init
Initialized empty Git repository in /var/projects/gitStashConflictExample/.git/
07:01:57 /var/projects/gitStashConflictExample (master)
$ touch poop
07:02:04 /var/projects/gitStashConflictExample {master}
$ git add poop
07:02:07 /var/projects/gitStashConflictExample {master}
$ git commit -m "i like vivid examples"
[master (root-commit) 24ec63b] i like vivid examples
0 files changed
create mode 100644 poop
07:02:22 /var/projects/gitStashConflictExample (master)
$ echo "adding some content" > poop
07:03:29 /var/projects/gitStashConflictExample {master}
$ git commit
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: poop
#
no changes added to commit (use "git add" and/or "git commit -a")
07:03:32 /var/projects/gitStashConflictExample {master}
$ git commit -am "added content to file"
[master 2a31725] added content to file
1 file changed, 1 insertion(+)
07:03:46 /var/projects/gitStashConflictExample (master)
$ echo "\nadd some more content" > poop
07:04:18 /var/projects/gitStashConflictExample {master}
$ cat poop
\nadd some more content
07:04:20 /var/projects/gitStashConflictExample {master}
$ echo "\nadd some more content" >> poop
07:04:29 /var/projects/gitStashConflictExample {master}
$ cat poop
\nadd some more content
\nadd some more content
07:04:30 /var/projects/gitStashConflictExample {master}
$ git stash
Saved working directory and index state WIP on master: 2a31725 added content to file
HEAD is now at 2a31725 added content to file
07:04:48 /var/projects/gitStashConflictExample (master)
$ git rm poop
rm 'poop'
07:04:57 /var/projects/gitStashConflictExample {master}
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# deleted: poop
#
07:04:59 /var/projects/gitStashConflictExample {master}
$ git commit -m "removing poop file"
[master b1daffa] removing poop file
1 file changed, 1 deletion(-)
delete mode 100644 poop
07:05:05 /var/projects/gitStashConflictExample (master)
$ git stash pop
CONFLICT (modify/delete): poop deleted in Updated upstream and modified in Stashed changes. Version Stashed changes of poop left in tree.
07:05:09 /var/projects/gitStashConflictExample {master}
$ git status
# On branch master
# Unmerged paths:
# (use "git reset HEAD <file>..." to unstage)
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# deleted by us: poop
#
no changes added to commit (use "git add" and/or "git commit -a")
07:05:12 /var/projects/gitStashConflictExample {master}
$ git add poop
07:05:29 /var/projects/gitStashConflictExample {master}
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: poop
#
07:05:31 /var/projects/gitStashConflictExample {master}
$ cat poop
\nadd some more content
\nadd some more content
07:05:36 /var/projects/gitStashConflictExample {master}
$ git commit -am "applied stash that had conflicts"
[master dcb3f8d] applied stash that had conflicts
1 file changed, 2 insertions(+)
create mode 100644 poop
07:05:45 /var/projects/gitStashConflictExample (master)
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment