Yes I know the OP already made 12 commits. Like I say in my explication: 
"First we create a feature_branch_name on the tip of the local master, 
since it is ahead of the origin's one." The new feature_branch will include 
these 12 commits. I included the stash step because I do not know the 
status of his working directory. 

The OP also pointed out that his remote is working fine with GitHub, so his 
master branch should already track the remote master branch. We only have 
to reset the local master branch to the tip of the remote one.

On Monday, September 10, 2012 8:14:59 AM UTC-4, RubyRedRick wrote:
> On Mon, Sep 10, 2012 at 7:25 AM, P Rouleau <<javascript:>
> > 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 <>
> Blog:
> Github:
> Twitter: @RickDeNatale
> WWR:
> LinkedIn:

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To view this discussion on the web visit
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to