2

I committed a change locally with Storyboards for iOS. I have not been able to merge them correctly with a friend of mine so I'm giving up. My changes are pretty small and I can redo them later. What I'd like to do is reverse the last commit without the storyboards and just keep my code. I tried following this:

How to undo last commit(s) in Git?

how i interpreted this was:

git reset --soft HEAD^

after this, I did git status, and I saw all my files in green in the staging area, including the storyboards. So i wanted to unstage them (or so I thought). So I did

git reset HEAD MainStoryboard*

Then I did not see my storyboard files on git status. I didn't see them in red either in the unstaged area which I thought was weird. So I then did

git commit -a -c ORIG_HEAD

It allowed me to change my commit message, but the commit was the same. It still commit my storyboard files. So I'm unsure of what is going on here.... Any thoughts? Thanks in advance.

Community
  • 1
  • 1
Crystal
  • 28,460
  • 62
  • 219
  • 393

2 Answers2

0

when doing reset, try to use -- to separate file list from revisions

git reset HEAD -- file_list

also use simple commit (not ammend form)

git add your_changed_files

git commit

Community
  • 1
  • 1
mighq
  • 1,004
  • 1
  • 13
  • 14
0

if unstaging a pattern doesn't work, you can try the approach in "GIT: I want to unstage all files matching a certain pattern":

for i in `git status --porcelain | grep '^M.*MainStoryboard.*$' | sed 's/^M \+//'`; do
    git reset HEAD -- "$i"
done
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250