fracz/git-exercises

Can't push the fixed bug in "save your work"

abalter opened this issue · 1 comments

I did the following:

  1. stash
  2. fix bug
  3. add and commit
    I get an error when I try to push.

What am I missing?

(base) balter@spectre:~/exercises$ git start save-your-work
Preparing the exercise environment, hold on...
Exercise save-your-work started!
Read the README.md for instructions or view them in browser:
http://gitexercises.fracz.com/e/save-your-work
(base) balter@spectre:~/exercises$ cat README.md
## Saving your work
You are working hard on a regular issue while your boss comes in and wants you to fix a bug. State of your current
working area is a total mess so you don't feel comfortable with making a commit now. However, you need to fix the found
bug ASAP.

Git lets you to save your work *on a side* and continue it later. Find appropriate Git tool and use it to handle
the situation appropriately.

Look for a bug to remove in `bug.txt`.

After you commit the bugfix, get back to your work. Finish it by adding a new line to `bug.txt` with

    Finally, finished it!

Then, commit your work after bugfix.
(base) balter@spectre:~/exercises$ git stash
Saved working directory and index state WIP on save-your-work: 98e0c28 Excellent version with a bug
(base) balter@spectre:~/exercises$ git pull
Already up to date.
(base) balter@spectre:~/exercises$ cat bug.txt
This file contains bug
It has to be somewhere.
I feel like I can smell it.
THIS IS A BUG - remove the whole line to fix it.
How this program could work with such bug?
(base) balter@spectre:~/exercises$ vi bug.txt
(base) balter@spectre:~/exercises$ cat bug.txt
This file contains bug
It has to be somewhere.
I feel like I can smell it.
How this program could work with such bug?
(base) balter@spectre:~/exercises$ git add .
(base) balter@spectre:~/exercises$ git commit -m "fixed the bug"
[save-your-work d158101] fixed the bug
 1 file changed, 1 deletion(-)
(base) balter@spectre:~/exercises$ git status
On branch save-your-work
Your branch is ahead of 'origin/save-your-work' by 2 commits.
  (use "git push" to publish your local commits)

nothing to commit, working tree clean
(base) balter@spectre:~/exercises$ git push
Enumerating objects: 8, done.
Counting objects: 100% (8/8), done.
Delta compression using up to 8 threads
Compressing objects: 100% (7/7), done.
Writing objects: 100% (7/7), 826 bytes | 826.00 KiB/s, done.
Total 7 (delta 2), reused 0 (delta 0), pack-reused 0
remote: (
remote: ************************************************************************
remote: Exercise: save-your-work
remote: Status: FAILED
remote: Expected number of commits: 3. Received 2.
remote:
remote: See your progress and instructions at:
remote: https://gitexercises.fracz.com/c/v3j
remote: ************************************************************************
remote: )
remote: Remember that you can use git verify to strip disturbing output.
remote: error: hook declined to update refs/heads/save-your-work
remote: error: The last gc run reported the following. Please correct the root cause
remote: and remove gc.log.
remote: Automatic cleanup will not be performed until the file is removed.
remote:
remote: warning: There are too many unreachable loose objects; run 'git prune' to remove them.
remote:
To https://gitexercises.fracz.com/git/exercises.git
 ! [remote rejected] save-your-work -> save-your-work (hook declined)
error: failed to push some refs to 'https://gitexercises.fracz.com/git/exercises.git'
(base) balter@spectre:~/exercises$
fracz commented
  1. Stash.
  2. Fix bug and commit
  3. Stash pop
  4. Finish your work and commit
  5. Send to verify!

Good luck!