Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== ====== ====== Git Cheatsheet ====== ===== Initialize & Add Remote Git ===== <code bash> git init git remote add origin <url> git fetch git branch --set-upstream-to=origin/<branch> master git pull </code> ===== Push Changes to Remote Git ===== <code bash> # Add all changes to the commit git add . # Commit with Comment git commit -m "<comment>" git push </code> ===== Delete All Commit History ===== <code bash> # 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 </code> ===== Pushing new branch requires username / password ===== <code bash> # Fix with git remote set-url origin git@github.com:<username>/<rep>.git # Push the branch git push origin <branch-name> </code> CKG Edit engineering/computer_science/git/resources/git_cheatsheet.txt Last modified: 2024/08/16 13:56by carlossousa