Git - Anton-L-GitHub/Learning GitHub Wiki

1. Initializing the project

Init folder

git init

Clone remote repo

git clone <url>

OBS! .gitignore | git status ??


2. Stage

Add file/s to stage

git add .

or git add <file>

Remove files form stage

git reset .

or git reset <file>


3. Committing

git commit -m "This is the commit message" 

OBS!
git status


4.Pull

ALWAYS before pushing

git pull origin master

5.PUSH

git push origin master

origin = name of remote repo
master = the branch that we push to

(First time push of branch)

git push -u origin <name-of-branch>

-u coordinates the two branches (local and on server)



Create a branch

git branch <name-of-branch>

Checkout a branch

git checkout <name-of-branch>

Merge a branch

git checkout master
git pull origin master
git branch --merged - see which branches are merged 
git merge <name of the branch you want to merge>
git push origin master

Delete a branch

Deletes repo locally!

git branch -d <name of the branch>

Deletes repo on remote!

git push origin --delete <name of the branch> 

Check the other repo branches

git branch -a - 

⚠️ **GitHub.com Fallback** ⚠️