Skip to content

Instantly share code, notes, and snippets.

@itroyano
Last active September 14, 2022 13:34
Show Gist options
  • Save itroyano/6f8341bbc9ac1961383f45e5cb09935f to your computer and use it in GitHub Desktop.
Save itroyano/6f8341bbc9ac1961383f45e5cb09935f to your computer and use it in GitHub Desktop.
git commands for new repo
In UI create a fork.
git clone <fork url>
git remote add upstream <url of the original repo I forked from> # Define what is the upstream
git config --global pull.rebase true # Set the local repository to rebase on pull
git branch --set-upstream-to upstream/main # Set local main to track upstream
git checkout <local branch>
git pull upstream main # Sync local branch with the upstream main. this will also rebase per the setting above
git commit -m <original commit msg> -s --amend # From 2nd commit onwards makes sure there's only one commit
git push --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment