Install Brew & Git (Mac)
Enter below in a MacOS Terminal or Linux shell prompt.
enter install code for Brew
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
enter install code for Git
$ brew install git
check Git version
$ git --version
Install Git(Window)
1.download git over https://git-scm.com
2.insatall git by clicking it
3.execute Git Bash installed.
User Configuration
Config UserNM & Email
$ git config --global user.email "bzhs1992@icloud.com"
$ git config --global user.name "HyunsooZo"
Check the list configrated
$ git config --list
Generate SSH Key
Command
$ ssh-keygen
Key-file name
$ input keyfile name you'd like to put
Password setting
Get rsa
input below and copy them.
$ cat ~/.ssh/keyfile.pub
Register rsa in Github
Setting> SSH and GPG keys >SSH key > new SSH key
titie: input
key : paste the rsa copied
Git Initialization
Command to initialize directory
$ git init
Command to remove(directory only)
$ rm -rf .git
.gitignore ?
what’s ‘.gitignore’?
~
the line will be annotated by using #
/folder name
the folder would be excluded when you commit to git
filename.format
the file would be excluded when you commit to git
/folder/file.format
the path would be excluded when you commit to git
/folder/*.format
those formats in the path would be excluded when you commit to git
/folder/\**/*.format
[Example for Java]
# Created by https://www.toptal.com/developers/gitignore/api/java
# Edit at https://www.toptal.com/developers/gitignore?templates=java
### Java ###
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
replay_pid*
# End of https://www.toptal.com/developers/gitignore/api/java
The operation principle of GitHub
Working Directory
Staging Area
Local Repository
Remote Repository

Clone
Command
$ git clone https://github.com/~~/~.git //HTTP
$ git clone git@github.com:HyunsooZo/~~.git //SSH
Branch Generation
$ git branch feature-branch(branch name)
$ git checkout feature-branch(branch name)
Merge
Move to the Branch
$ git checkout main
Proceed with merge
$ git merge (branch name)
Conflict
conflict in GitHub occurs when changes made to the same lines of code in different branches cannot be merged automatically, and require manual resolution by the user. This typically happens when two people are working on the same code simultaneously and make different changes to the same lines of code. The user must manually review the conflicting changes, decide which changes to keep, and then commit the resolved changes back to the branch.
Solution
Move to the Branch where Conflict occurred
$ git checkout (branch name)
Modify the file caused Conflict (Git will let you know the cause)
add the file on Staging Area
$ git add <resolved-file>
Solve all conflicts and commit
$ git commit -m "Resolved conflicts in <file-name>"
Push to Remote Repository
$ git push origin branch name