Ok, maybe I've misunderstood his problem. But now I'm sure I really know what does your answer script do , thanks a lot :-)
PS: what does mean OP in this context? Pozdrawiam, -- Łukasz Siwiński http://siwinski.info Wysłano z telefonu. 10-09-2012 17:22, "Rick DeNatale" <rick.denat...@gmail.com> napisał(a): > On Mon, Sep 10, 2012 at 8:55 AM, Łukasz Siwiński <lsiwin...@gmail.com>wrote: > >> Hmm... >> >> > Local Repo 12 commits ahead of origin/master >> >> means, that You haven't pushed your last 12 commits to remote (@github) >> origin/master branch >> >> if you do: >> >> git push >> # what is the same as >> git push origin master >> >> then You'll see your changes on github. >> > > First of all, it's not me it's the OP. and unless I misunderstood him, > that's what he DOESN'T want to do. > > Here's my understanding of his dilemma: > > First some time ago he fetched master from remote then he made some > changes, commited locally, and repeated 11 more times. > > Now he realizes that before making those changes he should have created a > new branch. > > >> 10-09-2012 14:14, "Rick DeNatale" <rick.denat...@gmail.com> napisał(a): >> >>> >>> On Mon, Sep 10, 2012 at 7:25 AM, P Rouleau <proulea...@gmail.com> wrote: >>> >>>> Your steps seem to imply he must use the same new_branch_name in 1) and >>>> in 5). We can simplify this by avoiding renaming the master branch. I >>>> believe it is already tracking the github's origin. >>>> >>>> So the steps can be rewritten like this: >>>> 1) git branch feature_branch_name >>>> 2) git stash >>>> 3) git fetch >>>> 4) git reset --hard origin/master >>>> 5) git push origin feature_branch_name >>>> 6) git co feature_branch_name >>>> 7) git stash pop >>>> >>>> First we create a feature_branch_name on the tip of the local master, >>>> since it is ahead of the origin's one. >>>> Then we stash the local changes and we reset the master branch to the >>>> same commit than the origin (3 & 4). The fetch is required when >>>> many developers push to the same remote. (Always use reset with care, since >>>> we can loose work. In doubt, create a temporarily branch as a safety net.) >>>> Then we create the feature branch on the remote (5). It does not need >>>> to be the current branch. >>>> Then we switch to the feature branch (6) and we recover the stashed >>>> modifications to continue the work on the feature branch. We can skip 5 if >>>> we do not want to publish it now and want to add more commits before. >>>> >>>> After that, we simply push to origin to update it with the new commits, >>>> ie: git push. If we commited on many tracked branches but want to push only >>>> one, we have to specify the branch name, ie: git push origin branch_name. >>>> >>>> >>> The problem is he said that he already made 12 commits to master in his >>> local repo. So that stash will only save any uncommitted changes since the >>> last commit. >>> >>> I believe that my suggestion will leave him in the same state as if he >>> had started the branch at the 'right' time in the past. >>> >>> -- >>> Rick DeNatale >>> >>> Google+: +Rick DeNatale <https://plus.google.com/102541178931067955550> >>> Blog: http://talklikeaduck.denhaven2.com/ >>> Github: http://github.com/rubyredrick >>> Twitter: @RickDeNatale >>> WWR: http://www.workingwithrails.com/person/9021-rick-denatale >>> LinkedIn: http://www.linkedin.com/in/rickdenatale >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Git for human beings" group. >>> To post to this group, send email to git-users@googlegroups.com. >>> To unsubscribe from this group, send email to >>> git-users+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/git-users?hl=en. >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Git for human beings" group. >> To post to this group, send email to git-users@googlegroups.com. >> To unsubscribe from this group, send email to >> git-users+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/git-users?hl=en. >> > > > > -- > Rick DeNatale > > Google+: +Rick DeNatale <https://plus.google.com/102541178931067955550> > Blog: http://talklikeaduck.denhaven2.com/ > Github: http://github.com/rubyredrick > Twitter: @RickDeNatale > WWR: http://www.workingwithrails.com/person/9021-rick-denatale > LinkedIn: http://www.linkedin.com/in/rickdenatale > > -- > You received this message because you are subscribed to the Google Groups > "Git for human beings" group. > To post to this group, send email to git-users@googlegroups.com. > To unsubscribe from this group, send email to > git-users+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/git-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Git for human beings" group. To post to this group, send email to git-users@googlegroups.com. To unsubscribe from this group, send email to git-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/git-users?hl=en.