-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update to Angular v9 automatically checks in the result! #16013
Comments
This is especially tough because users that are not very proficient with git will have a hard time removing these commits. |
This behavior can be disabled via the I believe the concept here was that an update is similar to the development of a PR for a feature or bug fix. A user would create a branch and then make a set of changes. After completion, adjustments would be made to ensure everything is working and then the results would be squashed/rebased and then pushed upstream for review and eventual merge. The commit per migration also has the advantage of allowing the changes from each migration to be viewed in isolation and altered with a higher degree of confidence, if needed. Explanations for the migrations are also contained within the corresponding commit messages. Some migrations can result in hundreds or more small changes across the entire codebase. cc @IgorMinar |
We don't tell users to make a branch in the update guide though, I think. I also wonder how these commits interact with projects that have git hooks for the commit messages. One of the projects I'm testing updates on uses |
This may work well for some users and use cases ... but not all developers using Angular are well experienced with git or have other standard processes and procedures. Plus with the automatic check-in, it is much more difficult to see which files that the update modified. Also, since it does at least 3 check ins, it makes it even harder for a developer to undo this. We should NOT be doing this without explicit permission. Make the flag Thanks! |
That was just an example use case; although one that probably should be considered a recommended practice. As to git hooks, they intentionally don't interact: |
Related to #14600 |
I agree this can cause issues with those inexperienced with git and it is something that should be considered. That linked issue, however, does provide an additional use case for the current behavior. Performing an update on top of an unknown quantity of uncommitted changes can have catastrophic results to a project. Although, the linked situation could be mitigated by adding an additional message instructing the user to verify and commit the results of the update operation. As an aside and for anyone curious, the command to remove the three last commits and keep the changes is |
I agree that this is certainly a surprising, even startling, change for many Angular CLI users. At minimum, if this is the default behavior, there need to be workspace options in I've tried a number of updates now across different apps with this behavior in place and I can tell you that it was never desirable in any of those cases.
I've had to use the In my experience doing updates to real world apps (which is significant), I've run into the above issues many times with this new behavior. I've never run into a case where I had a dirty branch with lots of unrelated changes and ended up with a catastrophic result. I am perfectly happy with a prompt or warning that costs me one extra key press during |
Although |
Perhaps a middle ground solution would be to ask after each update step (package changes, migration script) that makes a change to inform the user about the changes and ask if they wish to commit or continue? The challenge of not committing is that its very easy for changes to happen by the user that break the migration, and then its hard to track what happened. Git history can be a big help here, but as others have said it depends on one's familiarity with git. When 100s of files are touched automatically, I need confidence where those changes came from, me or the update process. Also, there can be failure message reported far up in the migration result logs that are easily lost by someone if they see it ends with success at the end. If each step was more individual with confirmation, I would feel more confident in understanding what happened. |
The name |
I suggest we make this a CHOICE:
As it is, the developer does not have an opportunity to see what is changed or easily undo the changes (minimum of THREE check ins) especially if they are not git experts. If we do need to keep this feature ... I suggest we add LARGE warnings everywhere that this auto check in will happen and that developers cannot just "try out" an update. |
Wow. All that’s missing is to skip the PR (why bother?) and push the branch ( I am wary of automatic commits. I am (mostly) unpersuaded by the arguments that I've read in favor. The following is a list of quotes (for and against) and my commentary from a slack channel thread. “It means that the exact changes made are in history now and I don’t accidentally make other changes and lose track of them in the mess.” Not convinced: The changes are in the working set (or maybe staged) so there is no history to lose. If I make more changes during the upgrade that is almost certainly because I had to make those changes as part of the update. “There are a lot of migration steps that might run, it would be nice if those were individually committed.” Yes but will I be able to make sense of the intermediate commits? Are they distinct in a way that is meaningful to the developer? Could I undo any of them? Reorder? Squash? I don’t really know why one commit or three and I am not sure why I should care. “there are errors that weren’t fixed automatically but they get lost in the stream of logs and easily missed.” Is that an argument FOR auto-committing? If an upgrade fails, after 2 previous commits, what is my recourse? Do I fix and restart? How? How do I roll back? Assume I’m a git tenderfoot who neglected to start a new branch (still in master) before upgrading. TBH, I am a person who has been trapped mid-update. When that happens, all I want to do is cry, rollback, and post a message on a slack channel. “The commit per migration [allows] changes from each migration to be viewed in isolation and altered with a higher degree of confidence, if needed. Explanations for the migrations are also contained within the corresponding commit messages.” This argument has some merit … although when you add that there can be “hundreds or more small changes across the entire codebase”, I think you’ve undermined that argument. The commit message is boilerplate. Could emit the combined messages to console or to a dated “I personally would like to check the changes once again before it gets committed.” I would like to do that too. While many people have tooling that makes it somewhat easy to review the changes wrought by recent commits, it sure is nice to see them in VS Code as pending changes. "This behavior can be disabled via the Seriously? Who knows about that … or will remember to add it? “This is especially tough because users that are not very proficient with git will have a hard time removing these commits.” I agree strongly. At least we should provide a mechanism to revert (perhaps display a Committing feels too paternalistic. If I know how to use git, you have kind of offended me. If I’m new to git, you’ve set me up for a potentially nasty fall as I do what the console invites me to do: The slack thread had more arguments in favor but I think I've addressed the strongest of them. Reasonable minds can (and do) differ on the value of auto-committing. I’d like to have the choice: (no commit by default) and have the benefits of auto-commit explained … along with a stern warning against the |
Just my 2 cents as well. When I saw the autocommit during the upgrade I was surprised. For me personally it is not that much of a big deal, as I'm doing the upgrade in a separate branch anyway and I used to always create intermediate commits during the upgrade (like after upgrading core and cli, and then after material etc). But, I see this a bit problematic for the "average developer" where - unfortunately - I still see a lot of problems related to everyday Git usage (that's why I created a hugely successful Git course on Egghead). So they would be irritated and wouldn't necessarily know how to undo these automatic commits etc. So
|
Just want to point out that the
The only way around this I could find was to kill the |
@benelliott There is no need to attempt to kill the process. All options are passed during the update bootstrap process.
This was tested with the latest published packages against a CLI 8.3.0 & Framework 8.2.13 project. |
@clydin Sorry about that - not sure what I did wrong initially! |
I'm in favor of flipping the default to be skipping the commits and leaving the sum of all changes on disk. I updated a bunch of applications last night, and I believe the most common usecase for users is to run a command that they don't fully understand (Migration can't be applied one by one as I understand it), and then analyze what it did via git status / visual tools. |
+1 for @DeborahK and the following! When you know there’s a new commit, this feature is more or less okay. But since there are schematics active that could update my code I want to check what they did before commiting this. This could be confusing for people who don’t know that a commit will be made. Of course everything is possible if you know what you're doing, I can undo a commit at any time… but anyway. I don’t see the real value of this change ;-) |
In addition to the above where I certainly agree with @DeborahK and @wardbell,
the path forward could be 1 of 2:
With option 2 you keep most of the benefits from the old way, and the new way. |
Just a quick note on point 3, undo-ing the update no matter the number of commits can be a single command if desired: The undo git command could also be offered to the user at the completion (successful or otherwise) regardless of the commit per migration decision outcome as it would be valid in both scenarios. |
@clydin looking up the |
I ran the I too vote for what @StephenFluin is suggesting. |
@SanderElias You're right and that is correct. But it would always be two steps regardless of the number of commits. Many IDEs with git integration (highly recommended in general) will also show the git history graphically which can reduce the user actions to only one git command. The outlined proposal above would also completely remedy the need for any lookup which, I agree, could be confusing for someone with limited git experience. |
@clydin The current version of the CLI doesn't do any commit's. So reverting back to the last known good state is always: git reset HEAD --hard And done. 1 step, no second guesses. I really hope this is not set in stone just yet! |
If auto-commit remains the default, can we print near the bottom of the console log
Such actionable information may go far to reduce anxiety. |
Alternatively, can we meet the requirement of providing migration change information by adding comments in the code? Something like this:
The benefits of this are:
The downside is:
Possibly two options then:
|
What about a dedicated log file in some exploitable format, yaml? Explaining which files have changed and why. |
2cents here If it's going to be done automatically, it should be squashed into one commit. But then that opens a lot of possibilities for errors and doesn't really provide a clear way to see what was changed. If it's going to be opt-in, then it could prompt the user asking if they wanted those changes to be committed. TL;DR, don't automatically commit changes 😄 |
This was resolved by changing the default to not commit and instead provide it as an option via Thanks for the feedback everyone. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: ....Description
When running: `ng update @angular/cli @angular/core --next --allow-dirty`It automatically checked in the result to my git repo. This is definitely NOT desired. In many use cases, this may be a "Trial" without a desire to check in. In other use cases, this may be a key dev environment that the developers would want to try out before committing.
In any case, this should NOT automatically check in without at least asking first.
UPDATE: In looking into this further, it does THREE commits during the update process.
🔬 Minimal Reproduction
Run: ng update @angular/cli @angular/core --next --allow-dirty
Check the Git change list, all changes are check in.
🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
@vikram @StephenFluin
The text was updated successfully, but these errors were encountered: