-
Set name:
git config --global user.name "Your Name"
-
Set email:
git config --global user.email "youremail@example.com"
-
Set user name
git config --global user.username username
-
Init:
git init
-
Status:
git status
-
Add:
git add file.txt
-
Commit:
git commit -m "Committed"
-
Different:
git diff
-
Add remote connections
git remote add <REMOTENAME> <URL>
-
Set a URL to a remote
git remote set-url <REMOTENAME> <URL>
-
Pull in changes
git pull <REMOTENAME <BRANCHNAME>
-
View remote addresses
git remote -v
-
Push changes
git push <REMOTENAME> <BRANCH>
-
Fork
- Click Fork button
-
Clone
-
Clone a respository
git clone <FORKEDURL>
-
Connect to the Original Repository
git remote add upstream <ORIGINALURL>
-
-
GitHub Pages
- GitHub will automatically serve and host static website files in branches named 'gh-pages'
-
Create a branch
git branch <BRANCHNAME>
-
Go into a branch
git checkout <BRANCHNAME>
-
Create and Go into a branch
git checkout -b <BRANCHNAME>
-
List the branches
git branch
-
Rename a branch currently on
git branch -m <NEWNAME>
-
Merge data
git merge <BRANCHNAME>
-
Delete local branch
git branch -d <BRANCHNAME>
-
Delete a remote branch
git push <REMOTENAME> --delete <BRANCHNAME>
-
Pull from a remote branch
git pull <REMOTENAME> <BRANCHNAME>