Skip to content

Instantly share code, notes, and snippets.

@alydemah
Last active February 20, 2020 16:23
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 alydemah/713389e87eaeee8542a2c4aef8befaff to your computer and use it in GitHub Desktop.
Save alydemah/713389e87eaeee8542a2c4aef8befaff to your computer and use it in GitHub Desktop.
myGitCheatSheet

git init

INIT Create Git Repo

Commit

Merge

Rebase

....

Deleting the .git folder may cause problems in your git repository. If you want to delete all your commit history but keep the code in its current state, it is very safe to do it as in the following:

Checkout

git checkout --orphan latest_branch

Add all the files

git add -A

Commit the changes

git commit -am "commit message"

Delete the branch

git branch -D master

Rename the current branch to master

git branch -m master

Finally, force update your repository

git push -f origin master

PS: this will not keep your old commit history around

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment