Skip to content

Instantly share code, notes, and snippets.

@rubenarakelyan
Created December 21, 2021 15:55
Show Gist options
  • Save rubenarakelyan/cc5163ab33f84524d03f1dde2b2e9bc4 to your computer and use it in GitHub Desktop.
Save rubenarakelyan/cc5163ab33f84524d03f1dde2b2e9bc4 to your computer and use it in GitHub Desktop.
List of commonly-used git commands

Squash commits

git rebase -i origin

Force push without changes

git commit --amend --no-edit && git push -f

Change file permissions

git update-index --chmod=+x [filename]

Add an upstream

git remote add upstream [github url]

Sync a fork with the upstream

git fetch upstream
git checkout master
git merge upstream/master

Bring a forked branch back into upstream

git remote add fork [email protected]:forked-owner/forked-repo.git
git fetch fork
git checkout patch-1
git push origin patch-1
git remote remove fork
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment