A list of commonly used Git commands:
Command | Description |
---|---|
git init |
Initialize a local Git repository |
git status |
Check status |
git add [file-name.txt] |
Add a file to the staging area |
git commit -m "[commit message]" |
Commit changes |
git log |
View changes |
git log --summary |
View changes (detailed) |
git remote add origin ssh://[email protected]/joshnh/[repository-name].git |
Add a remote repository |
git remote set-url origin ssh://[email protected]/joshnh/[repository-name].git |
Set a repository's origin branch to SSH |
git push -u origin [branch name] |
Push changes to remote repository (first time) |
git push |
Push changes to remote repository (subsequent times) |
git pull origin [branch name] |
Pull changes from remote repository |
git clone ssh://[email protected]/joshnh/[repository-name].git |
Create a local copy of a remote repository |
git push origin --delete [branch name] |
Delete a remote branch |
git rm -r [file-name.txt] |
Remove a file (or folder) |