Git Cheatsheet




Create a repo

git init hello-world-repo

Clone a repo

git clone [url]

Branches

git branch                  # list all local branches
git branch [branch-name]    # creates a new branch with given name
git checkout [branch-name]  # switch to given branch 

Commits

 git add .                           # Add all files
 git commit -m "commit message"      # commit 

MISC

git config --global user.email "[email protected]"        # Global user email
git config --global user.name "Foo Bar"             # Global user name

git config user.email "[email protected]"        # repo specific user email
git config user.name "Foo Bar"             # repo specific user name

git remote rm origin                       # Rmoves origin
git remote add origin https://github.com/foo/bar.git # Add origin


┬ęCopyright 2019 OneCompiler | Privacy Policy | Terms & Conditions