carbon-tutorial-angular icon indicating copy to clipboard operation
carbon-tutorial-angular copied to clipboard

Step 1: non-fast-forward error (incorrect solution in tutorial)

Open warnerjc opened this issue 5 years ago • 4 comments

The solution for resolving the non-fast-forward error in Carbon Tutorial Angular Step 1 is incorrect or misleading.

The user must git push origin angular-step-1 --force, other wise following the git pull upstream angular-step-1 will delete all files in your local angular-step-1 branch and leave you in a angular-step-1|MERGE (resolve conflict) state that contains no conflicts to resolve.

warnerjc avatar Feb 24 '20 17:02 warnerjc

Thank you for this comment. I hope the Carbon-Angular team fixes this issue soon.

JesseMartinIBM avatar May 18 '20 19:05 JesseMartinIBM

@warnerjc , I followed your suggestion and could push my changes. However, now on Step 2 the command git checkout -b angular-step-2 upstream/angular-step-2 throws the following errors:

karma.conf.js: needs merge
package-lock.json: needs merge
package.json: needs merge
src/app/app-routing.module.ts: needs merge
src/app/app.module.ts: needs merge
src/app/header/header.component.html: needs merge
src/styles.scss: needs merge
error: you need to resolve your current index first

Would you know how to resolve this too? Since at the end of Step 1 it was mentioned that they won't merge.

pooshonbanerjee avatar Oct 14 '20 11:10 pooshonbanerjee

@pooshonbanerjee git checkout -b angular-step-2 upstream/angular-step-2 wants to create a new local branch, but your current branch has un-staged commits.

You don't necessarily need those changes, since the tutorial will start you off with all the correct files when creating the new local branch.

In that case, you can do one of several things:

  1. Stage all the changes using git add -A, commit all the changes using git commit -m 'resolve merge conflict', and push those changes to your Stage 1 GitHub branch git push origin <my-stage-1-branch>. Then use git checkout -b angular-step-2 upstream/angular-step-2 to create your new local branch.
  2. Reset all local changes using git reset --merge and then use git checkout -b angular-step-2 upstream/angular-step-2 to create your new local branch`.
  3. Reset all local changes on the current branch using git reset HEAD <my-stage-1-branch> and then use git checkout -b angular-step-2 upstream/angular-step-2 to create your new local branch`.

StackOverflow with more explanation on these:

https://stackoverflow.com/questions/6002732/why-can-i-not-switch-branches/31697708

warnerjc avatar Oct 14 '20 13:10 warnerjc

Thanks @warnerjc , I will try one of these steps. What I am worried about though is my previous push for Step 1 is still open, probably because of the merge conflicts, and if it stays that way, it may not count towards the completion of this training program. So I am thinking of doing it all over again, what do you suggest? And please accept my apologies if I am dragging you unnecessarily into something which I am supposed to figure out on my own.

pooshonbanerjee avatar Oct 16 '20 05:10 pooshonbanerjee