Some useful Git commands
Here is a list of some basic Git commands to get you going with Git.
git init
git clone /path/to/repository
git add <filename> OR git add *
Commit changes to head (but not yet to the remote repository): git commit -m "Commit message" Commit any files you've added with git add
, and also commit any files you've changed since then: git commit -a
git push origin master
git status
Connect to a remote repository
git remote add origin <server>
Create a new branch and switch to it: git checkout -b <branchname> Switch from one branch to another: git checkout <branchname> List all the branches in your repo, and also tell you what branch you're currently in: git branch Delete the feature branch: git branch -d <branchname>