All processes are carried out by opening the terminal and entering Git commands. This is the content from deleting commits in the local repository to reflecting changes in the remote repository.
Deleting Commits While Keeping Changes
git reset HEAD^
Deletes the most recent commit
git reset HEAD~n
Delete the last n commits
Deleting Both Commits and Changes
git reset --hard HEAD^
Deletes the most recent commit
git reset --hard HEAD~n
Delete the last n commits
Checking Branches and Reflecting Changes in the Remote Repository
git branch
You can use this Git command to find out the name of the branch you are working on.
git push origin main --force
If you are not on the main branch, replace main with the name of your branch.
Using a force push(--force) alters the history of the remote repository, so it is advisable to avoid using it unless necessary. If you are working on a branch alone, it may not be an issue, but if other team members are working on the same branch, it could affect their work.
'Insights (종료) > For EN' 카테고리의 다른 글
[CS] 1.1 + 0.1 != 1.2, Why? (1) | 2024.12.13 |
---|---|
[Python] Three Methods to Reverse a List (0) | 2024.12.06 |
[Python] BOJ 11718: No input values, No EOFError? (0) | 2024.11.22 |
[Python] BOJ 2675: Escape Character with a Debugger (1) | 2024.11.15 |
[Python] BOJ 10809: Does the find() return only the index? (3) | 2024.11.08 |