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 
For more options, visit this group at 

Reply via email to