Skip to content

Instantly share code, notes, and snippets.

@Aldizh
Last active May 2, 2020 01:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aldizh/d062abd329a3ebed5a6416cd6c6f5edc to your computer and use it in GitHub Desktop.
Save Aldizh/d062abd329a3ebed5a6416cd6c6f5edc to your computer and use it in GitHub Desktop.
Helpful github tips and commands
# Whenever i start coding i like to start with this command to clean up the repo and find out where we are
$ git fetch --prune origin && git status
# Merging is usually a good strategy as it allows for better tracking and dividing up the work
# Github offers a squash && merge option now on the PRs, but lets consider this:
# You want to test the feature branch locally before merging it and if there are any conflicts you want to resolve and test
$ git checkout master
$ git merge --squash feature_branch
$ git reset origin/master (Optional if we want to unstage all files that differ from origin master)
$ git add --all
$ git commit
# Re-writing history (Destructive way)
$ git commit --amend => Lets you edit last commit
$ git rebase -i HEAD~3 => Interactively update/remove and reapply last 3 commit messages
# Alternative we can use -f flag, though not recommended
$ git push -f origin banch_name
# Do your self a favor and set aliases for some commonly used commands
# This is how you can check the config list
$ git config --list | grep alias
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment