Clone a repository
- This command will create a directory using the repository name.
git clone [guthub SSH URL]
Create a New Local Repository
- Create a github repository without initializing.
- From a new or existing local directory, initialize and commit.
git init git add * git commit -m "first commit" git remote add origin [URL] git push -u origin master
Create a new branch
git checkout -b newBranch git push -u origin newBranch
List Branches
git branch // lists local branches git branch -a // lists all local and remote
Merge branches
git checkout master //switch to master branch git pull //Update the local repository git merge otherBranch //Merges master branch with otherBranch git push //Updates the remote repository
Delete a branch
git branch -d branchName git push origin --delete branchName
Check Status
git status
Add files to index
git add [file name] or git add *
Commit to local repository
git commit -m "Commit comment goes here"
Push to remote repository
git push
Add a Tag
git tag "1.0.0.Release" -m "Releasing version 1.0.0" git push --tags