Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAmber Hoddinott
6,494 Pointsgithub is saying its ahead one commit, can anyone help me please
hi have followed some advice online on how to remove a commit from my online github repository
this is the command is used and it seemed to of worked as the commit on my github has gone....
git push -f origin HEAD^:master
....but now when i try and commit my next change i get this message...
Your branch is ahead of 'origin/master' by 1 commit. (use "git push" to publish your local commits) nothing to commit, working directory clean
and if i carry on and push my code to my online repository it is pushing the previous commit and not the one i am trying to commit now.
can anyone explain to me what i have done and what it means by its ahead, im guessing it means its still on my previous commit and thats why its pushing that commit rather than my current one. if this is the case how do i get it to move to my current commit and forget the previous one i have remove already from my github repository.
hope this makes sense ? :D
Thanks in advance !!! Amber
2 Answers
Nathan Tallack
22,160 PointsTry a git fetch -p
This will prune deleted branches from your repo. Could be your problem.
If that does not work, try a git pull --rebase
This will push your local commit aside and resynchronise with the master.
Amber Hoddinott
6,494 PointsThank you!!! the second command has worked! :D
Nathan Tallack
22,160 PointsWelcome. :)