- Add osc2023 as the upstream
git remote add -t <your student id> upstream https://github.com/oscapstone/osc2023.git git fetch upstream
- Checkout your branch from the upstream
git checkout -b <local branch name> upstream/<your student id>
- Push the branch to your forked repo
git push -u origin <local branch name>
Warning: If you not no fully understand what are you doing, please backup the repo. TAs are not responsible for any mistake in this section or any damage produced by your git operations. If you need to modify the history that has been merged into the upstream repo, please contact with TA.
Just modify the latest commit
git rm --cached <filename>
git commit --amend -C HEAD
What if you have pushed to Github? Force push again.
git push -f origin <your student id>
I suggest that you use git rebase
to modify the history.
First, use git log
to find the commit you added the file.
Suppose the commit id is 7a45f90
. Use the commit before 7a45f90
as the
newbase.
git rebase -i 7a45f90^
This command pops up the editor. Modify pick 7a45f90
to edit 7a45f90
, then
save and close the editor.
git rm --cached <filename>
git commit --amend
Repeatedly use the following command until the rebase procedure finished.
git rebase --continue
# if there is conflict
git rm <filename>
You might need to force push to the github repo.
Warning: force push is not revertable.
git push -f origin