Skip to main content

GitHub: I always need to cheat on this

·170 words·1 min· loading · loading · ·
Aphcity
Author
Aphcity
I’m just an average student, and I do forget things

Setup Git
#

I should know how to do apt, after apt, we need to set up the global config.

git config --global user.name "<yourusername>"  
git config --global user.email "<youremail>"

Rebase? Merge?
#

Basically, Merge and Rebase both give us a way to pull the published commits to local branch and keep local commits not lost. But they used different logic to make this happen, even they could come to a same endpoint.

In short, if we have unpublished local commits or changes, it prefers to use Rebase since it is friendly for both local repository and remote one. But if there are published commits in our branch, we should better merge or simply continue work on the existing one, and then create a PR to Merge into main branch. Only this way can keep the repository code clean and history readible. And under this circumstance, if we rebase the code, we might created multiple duplicated commits for those published commits, and that will lead to a chaotic commit history.