# Git x GitHub
--Allen--
---
## What is Git?
----
Version Control
----

----

----
- History
- Project (Collaboration)
---
## Let's get started!
----
Download
----
$ git config --global user.name "user"
$ git config --global user.email "user@email"
----
$ vim ~/.gitconfig
----
## Warm Up
----
$ git init
----

----
```git
$ git add --all # add *ALL* files
$ git add . # add all files in current folder
$ git add *FileName* # add the file
```
----
```git
$ git commit -m "New Commit"
$ git commit -am "New Commit" # git add && git commit
```
----
```
$ git commit --amend
```
----

---
## See what we've done
----
```
$ git log
$ git log --oneline
$ git log --graph
$ git log --all
```
----

---
## Let's move a bit further
----
Review a bit

----
```
$ git branch branchName
$ git checkout branchName
$ git checkout -b branchName # create & checkcout
```
----
```
$ git checkout commitID
```
---
git merge

----
```
$ git merge branchName # merge branchName to current branch
```
----
conflict
---
## More to learn...
----
git diff
----
```
$ git diff branch1..branch2
```
---
## GitHub
----
<div style="background-color: white">
<img src="https://i.imgur.com/RV0cIK9.png" />
</div>
----
What's GitHub
----

----

---
## Let's get started
----
create a new repository (repo)
---
## SSH
---
if you are window users....
----
openSSH
----
Settings -> Apps -> Optional features -> openSSH
----
- https://blog.alantsai.net/posts/2015/09/use-ssh-in-windows-for-github
- beware: ed25519
---
if you are mac, linux users:)
----
```
$ ssh-keygen -t ed25519 -C "your_email@example.com"
$ cd ~/.ssh
$ cat id_ed25519.pub
```
----
github > settings > SSH and GPG keys > new SSH keys
```
$ ssh -T git@github.com
```
---
push it to the remote repo!
----
```
$ git remote add origin <repo_url>
$ git push -u origin currentBranch
$ git pull
```
----
git push -u origin currentBranch?
```
$ git push origin currentBranch
$ git checkout currentBranch
$ git branch -u origin/currentBranch
```
----
Check the branches
----
```
$ git branch
$ git branch -r # remote
$ git branch -a # all
```
---
Sometimes, you just don't care about others...
----

---
Need some idea from other?
----
```
$ git clone <repo_url>
```
---
## Other stff?
----
.gitignore
{"metaMigratedAt":"2023-06-16T20:07:47.085Z","metaMigratedFrom":"YAML","title":"Git x GitHub","breaks":true,"contributors":"[{\"id\":\"dd2e311c-6db4-4e6f-8e33-d37e4c6a2326\",\"add\":2864,\"del\":109}]"}