Skip to content
This repository has been archived by the owner on Mar 11, 2019. It is now read-only.

nscale reports branch <x> is ahead of branch <y> by some commits #87

Open
xqjibz opened this issue May 13, 2015 · 6 comments
Open

nscale reports branch <x> is ahead of branch <y> by some commits #87

xqjibz opened this issue May 13, 2015 · 6 comments

Comments

@xqjibz
Copy link

xqjibz commented May 13, 2015

Scenario:

  • working in a branch from a system.
  • you have already deployed in master or another branch
  • you create a new branch, and make changes to services/system

nscale system compile produces the following:

Already on 'master'

M   definitions/services.js
Your branch and 'origin/master' have diverged,
and have 25 and 11 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)
From https://github.com/CoderDojo/cp-deployer
 * branch            master     -> FETCH_HEAD

error: Your local changes to the following files would be overwritten by merge:
    definitions/services.js
Please, commit your changes or stash them before you can merge.
Aborting

command failed

The branch listed above, may be master, or may be something else.

Solution:
nscale system unlink <system-name or directory-of-cloned-system>
nscale system link . in your current working directory, on the branch you want to modify

Explanation (this is not correct)
When nscale produces a system the branch of the repository gets recorded for subsequent use. Once you change the branch in the repository, you are still using the original linked github repository. In order to make changes in a branch, simply unlink and link the system appropriately.

@mcollina
Copy link
Contributor

I followed your instructions and I could not reproduce. Can you please make instructions using https://github.com/nearform/sudc-system?

I'm not really getting the explanation, nscale does not store the branch of the system repository anywhere.

@xqjibz
Copy link
Author

xqjibz commented May 18, 2015

Yes, let me try this again, it's only happening when I switch branches. It just seemed like somehow the system was keying off of what branch I was on. I will fork sudc and attempt to reproduce.

The thing that gets me here is, why is nscale using master, when I was on the other branch? Is there something in one of the definitions that sets that?

@xqjibz
Copy link
Author

xqjibz commented May 19, 2015

I ran into this again, received the following error:

our branch is behind 'origin/master' by 46 commits, and can be fast-forwarded.
  (use "git pull" to update your local branch)
From github.com:CoderDojo/cp-zen-platform
 * branch            master     -> FETCH_HEAD

error: Your local changes to the following files would be overwritten by merge:
    web/public/templates/common/content-header.dust
Please, commit your changes or stash them before you can merge.
Aborting

Updating 6bfc6df..c3359e9
command failed

This one is different, in that what was in the workspace, for this repository is on another branch than what is in the definition. To solve this one during an nscale system compile I simply rm -fr workspace/ and that solved it, I would also imagine (and did not test) that checking out master for this repository would have solved it as well. This particular error, I'm OK with, in that when doing a system compile I'm re-visiting the entire system state.

I still haven't gotten around to checking out the nscale demo app and modifying it. I will do so soon, the original error confounds me, and I'm seeking to understand what is happening so it can be avoided in some meaningful way.

@mcollina
Copy link
Contributor

Albeit not optimal, the last one is expected.

I'm curious at the first one too, as I could not replicate it.
Il giorno mar 19 mag 2015 alle 19:55 Robert Myers notifications@github.com
ha scritto:

I ran into this again, received the following error:

our branch is behind 'origin/master' by 46 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
From github.com:CoderDojo/cp-zen-platform

  • branch master -> FETCH_HEAD

error: Your local changes to the following files would be overwritten by merge:
web/public/templates/common/content-header.dust
Please, commit your changes or stash them before you can merge.
Aborting

Updating 6bfc6df..c3359e9
command failed

This one is different, in that what was in the workspace, for this
repository is on another branch than what is in the definition. To solve
this one during an nscale system compile I simply rm -fr workspace/ and
that solved it, I would also imagine (and did not test) that checking out
master for this repository would have solved it as well. This particular
error, I'm OK with, in that when doing a system compile I'm re-visiting
the entire system state.

I still haven't gotten around to checking out the nscale demo app and
modifying it. I will do so soon, the original error confounds me, and I'm
seeking to understand what is happening so it can be avoided in some
meaningful way.


Reply to this email directly or view it on GitHub
#87 (comment).

@xqjibz
Copy link
Author

xqjibz commented May 19, 2015

@mcollina I will work sometime today to replicate the first one, as it doesn't make any sense to me either. :)

@xqjibz
Copy link
Author

xqjibz commented May 20, 2015

@mcollina I cannot reproduce this using the sudc test application. I didn't do anything different for the test app as far as I can tell.

I did some extra things too:

  • switched branches back to master, made changes, system compile, push those, go back to my branch, unable to reproduce
  • from my test branch, stop nscale, start nscale, nscale login, nscale system link ., unable to reproduce.
  • from master, system link ., stop nscale, start nscale, login, compile, switch branches, system link . again, compile, unable to reproduce.

Bottom line is, it's working as I expect it to work, in that: changes to the system under a branch only affect that branch of the system, not master of the original system, or some other deployable branch.

There must be some combination of steps I am doing to generate the original message, that is causing me to have to unlink then link again. I just cannot seem to reproduce the problem. There may be something special with our particular project, though, I cannot determine what if anything.

Maybe this is something I did to make git think that I was on the wrong branch, though, I can't quite sort out why I would even receive the above message. It appears to be a git pull error, but I cannot be certain.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants