Skip to content

Instantly share code, notes, and snippets.

@lkevinzc
Created March 27, 2024 13:35
Show Gist options
  • Save lkevinzc/ff6e32255ad8161a959a14ccc0fc8949 to your computer and use it in GitHub Desktop.
Save lkevinzc/ff6e32255ad8161a959a14ccc0fc8949 to your computer and use it in GitHub Desktop.
  1. Before adding new feature or a PR is merged at remote, at main branch:
  • git fetch: get updates from remote repo
  • git reset --hard origin/main: sync local main to be the same as remote main; this can remove any changes at local, so should be called before adding any changes
  1. To create new features:
  • git checkout -b feature-name: new a branch named "feature-name"
  • modify codes and commit
  • (if at the same time remote main is changed due to another PR) git checkout main; git fetch; git reset --hard origin/main then git checkout feature-name; git rebase origin/main and resolve any conflicts
  • git push -u origin feature-name for the first time to push a local branch to remote or simply git push if the branch already exists at remote
  1. Do pull request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment