What do you think will happen when you try to push? When they push, they'll have to 'force push', which should show to them that they're changing history. Meanwhile, you keep working with the commit that the collaborator tried to delete. They continue new commits from the commit directly before that. But, they make a change that deletes the most recent commit. Imagine - You and another collaborator have the same repository, with the same history. What can go wrong while changing history?Ĭhanging history for collaborators can be problematic in a few ways. Undoing a commit on work that you only have locally is much safer.If you are "undoing" a commit that exists on the remote, you could create big problems for your collaborators.If you find yourself in this situation, there are a few very important things to remember: Sometimes, you may need to change history. To see all of the possible options you have with git commit, check out Git's documentation. git commit -amend: Replaces the most recent commit with a new commit. The addition of -a will automatically stage any files that are already being tracked by Git (changes to files that you've committed before).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |