diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cdada3b..ab66ddf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,3 @@ - --- # Contributing to Multiplayer UNO Game @@ -91,7 +90,7 @@ If any merge conflicts occur, you will need to resolve them manually. Code edito Now the local copy of the branch is synced with upstream/main. You need to force push these changes to origin, since the commit history has been rewritten. ```bash -git push origin --force +git push --force ``` ### Editing commit history @@ -129,13 +128,17 @@ pick 3m4n5o6p Commit msg 4 ``` Save the changes and exit. -After saving the changes, git will then apply the 2nd commit and pause. You can now make the necessary changes to the code, and then stage the changes (Using `git add .`). You then incorporate the changes to the 2nd commit using `git commit --amend`. You can also change the commit message using this command. +After saving the changes, git will then apply the 2nd commit and pause. You can now make the necessary changes to the code, and then stage the changes (Using `git add .`). You then incorporate the changes to the 2nd commit using `git commit --amend`. The editor opens, asking for commit meessage. You can change the commit message if needed at this needed. + + +#### "Uncommitting" a commit +When you choose to edit the 2nd commit, git pauses **after** applying the second commit. You might wish to uncommit all the changes made in the 2nd commit. In that case, you run `git reset HEAD~1`. This will uncommit the changes made in the 2nd commit, but keep the changes in the working directory. You can then make the necessary changes and commit them again. The `git reset` command can be used to uncommit any number of commits. For example, `git reset HEAD~2` will uncommit the last 2 commits. Note that after doing this operation, there would be no way to distinguish the changes made in the two commits. This command can be used outside of an interactive rebase as well. After making the changes, you can continue the rebase process by running `git rebase --continue`. Git will then apply the 3rd commit and pause again. You can then change the commit message using `git commit --amend`. After making the changes, you can continue the rebase process by running `git rebase --continue`. When there are no more commits left, the rebase process will be complete. -After all the commits have been applied, you can push the changes to your branch using `git push origin --force`. This will overwrite the commits in the remote branch in your forked repository with the changes you just made locally. +After all the commits have been applied, you can push the changes to your branch using `git push --force`. This will overwrite the commits in the remote branch in your forked repository with the changes you just made locally. #### Tip VSCode provides a helpful UI to perform these operations. You can set the default text editor for Git to VSCode by running the following command: