ํ‹ฐ์Šคํ† ๋ฆฌ ๋ทฐ

๊ฐœ๋…์ ์ธ ๋ถ€๋ถ„์€ ์ œ์™ธํ•˜๊ณ  ๊นƒ์— ๋Œ€ํ•œ ์‚ฌ์šฉ๋ฒ• ์ฝ”๋“œ๋งŒ์„ ์ •๋ฆฌํ•œ ๊ธ€์ž…๋‹ˆ๋‹ค.

 

 

1. git init

๊นƒ ์ดˆ๊ธฐํ™”

 

2. git status

๊นƒ ์ƒํƒœ ํ™•์ธ

 

3. git add .

๊นƒ์— ํŒŒ์ผ ์ถ”๊ฐ€

 

3-2. git rm --cached ํŒŒ์ผ์ด๋ฆ„

push ์ทจ์†Œ (์›๊ฒฉ์ €์žฅ์†Œ์—์„œ ํ•ด๋‹น ํŒŒ์ผ ์ œ๊ฑฐ, ๋กœ์ปฌ์—์„œ๋Š” ์ œ๊ฑฐ์•ˆ๋จ)ex. API_KEY_Secret.xcconfig ํŒŒ์ผ์„ ์‹ค์ˆ˜๋กœ pushํ•˜์—ฌ ์›๊ฒฉ์ €์žฅ์†Œ์— ์˜ฌ๋ ค๋ฒ„๋ ธ๋‹ค. ํ•˜์ง€๋งŒ ์ œ๊ฑฐํ•ด์„œ push ํ•˜๋”๋ผ๋„ cache๊ฐ€ ๋‚จ์•„์žˆ๋Š”๋ฐ git rm--cached API_KEY_Secret.xcconfig ํ•˜์—ฌ์›๊ฒฉ์ €์žฅ์†Œ์— ๋‚จ์•„์žˆ๋Š” cache๋ฅผ ์ œ๊ฑฐํ•  ์ˆ˜ ์žˆ๋‹ค!!

 

3-3. git rm --cashed ํŒŒ์ผ์ด๋ฆ„

์›๊ฒฉ์ €์žฅ์†Œ์—์„œ ํ•ด๋‹น ํŒŒ์ผ์„ ์‚ญ์ œ

ex)git rm --cashed .xcconfig

 

3-3 git reset HEAD ํŒŒ์ผ์ด๋ฆ„

ํ•ด๋‹น ํŒŒ์ผ๋งŒ git add ์ทจ์†Œ (stage ์˜์—ญ์—์„œ ํ•ด๋‹นํŒŒ์ผ ์ œ๊ฑฐ)

 

3-4. git reset HEAD

git add ์ทจ์†Œ (staging ์˜์—ญ์˜ ํŒŒ์ผ๋“ค ์ œ๊ฑฐ)

 

3-5. touch .gitignore

       vi .gitignore

gitignore์— ์ž‘์„ฑํ•œ ์œ ํ˜•, ํŒŒ์ผ ์ด๋ฆ„์€ git add ํ• ๋•Œ ์ œ์™ธ.

ex. api_key๋ฅผ ์—…๋กœ๋“œ ํ•˜์ง€์•Š๊ธฐ์œ„ํ•ด .gitignore ์•ˆ์— *.xcconfig ์ถ”๊ฐ€ํ•˜๊ณ  wq๋กœ ์ €์žฅ

( https://github.com/github/gitignore/blob/master/Swift.gitignore ์ฐธ๊ณ )

 

4. git commit - m "๋‚ด์šฉ"

๊นƒ ๋ณ€๊ฒฝ ์‚ฌํ•ญ ๋‚ด์šฉ text

 

5. git log

์ปค๋ฐ‹๋œ ๊นƒ ๋‚ด์šฉ ( date, author, commit id ) ์ถœ๋ ฅ

 

5-1. git reset HEAD^

์ตœ๊ทผ ์ปค๋ฐ‹ ์ทจ์†Œ

 

5-2. git reset HEAD~N

์ตœ๊ทผ ์ปค๋ฐ‹ N๊ฐœ ์ทจ์†Œ

 

6. git checkout ํŒŒ์ผ์ด๋ฆ„

ํŒŒ์ผ์„ ์ตœ๊ทผ์˜ ๊นƒ ์—…๋ฐ์ดํŠธ ๋‚ด์šฉ์œผ๋กœ ๋ณ€๊ฒฝ ( ์ปค๋ฐ‹ํ•˜์ง€ ์•Š์€ ๋ณ€๊ฒฝ ์‚ฌํ•ญ ํ๊ธฐ )

 

7. git remote add origin https://github.com/~~/~~.git

github repository๋ž‘ ์—ฐ๊ฒฐ

 

8. git push -u origin master

github repository์— ์—…๋กœ๋“œ

(origin = Name of Remote, matser = Name of Branch)

 

*git push๋Š” Local Repository์˜ git์„ Remote Repository์ธ GitHub์— upload ํ•˜๋Š” ์ž‘์—….

 

9. git clone https://github.com/~~/~~.git 

github์— push๋˜์–ด ์žˆ๋Š” project๋ฅผ ๊ฐ€์ ธ์˜ต๋‹ˆ๋‹ค.

 

10. git branch ๋ธŒ๋Ÿฐ์น˜์ด๋ฆ„

์ƒˆ ๋ธŒ๋Ÿฐ์น˜ ๋งŒ๋“ค๊ธฐ

 

11. git branch

๋ธŒ๋Ÿฐ์น˜ ๋ชฉ๋ก ๋ณด๊ธฐ( + ํ˜„์žฌ ๋ธŒ๋Ÿฐ์น˜์— *ํ‘œ์‹œ )

 

12. git checkout ๋ธŒ๋Ÿฐ์น˜์ด๋ฆ„

๋ธŒ๋Ÿฐ์น˜ ์ „ํ™˜ํ•˜๊ธฐ

 

13. git checkout ์ปค๋ฐ‹id

ํ•ด๋‹น ์ปค๋ฐ‹ ์‹œ์ ์œผ๋กœ ์ด๋™. ๋˜๋Œ์•„์˜ฌ๋• checkout matser ํ•ด์ฃผ๋ฉด ๋จ.

 

14. git merge '๋ธŒ๋Ÿฐ์น˜์ด๋ฆ„'

ํ•ด๋‹น ๋ธŒ๋Ÿฐ์น˜๋ฅผ ํ˜„์žฌ ๋ธŒ๋Ÿฐ์น˜์™€ ๋ณ‘ํ•ฉ

(github Insight > Graph > Network์—์„œ ๊ทธ๋ž˜ํ”„๋กœ ํ™•์ธ ๊ฐ€๋Šฅ)

 

xcode์—์„œ ๊นƒํ—™ ์—ฐ๋™

https://www.udemy.com/course/ios-13-app-development-bootcamp/learn/lecture/10929414#overview

 

Tip. xcode์—์„œ ๋ฒ„์ „ ์—๋””ํ„ฐ๋ฅผ ๋ˆ„๋ฅด๋ฉด ๋™์‹œ์— ๋‘ ๋ธŒ๋Ÿฐ์น˜ ์ฝ”๋“œ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

( ํ„ฐ๋ฏธ๋„ ๊ธฐ์ค€ git diff ๊ธฐ๋Šฅ ๊ฐ™์•„์š”.. )

 

 

xcode ์šฐ์ธก ์ƒ๋‹จ

 

์ด๋ ‡๊ฒŒ xcode ์šฐ์ธก ์ƒ๋‹จ์— ์žˆ๋Š” ๊ต์ฐจ ํ™”์‚ดํ‘œ๋ฅผ ๋ˆ„๋ฅด๊ฒŒ ๋˜๋ฉด

 

 

์ด๋ ‡๊ฒŒ ๋‘ ์ฐฝ์œผ๋กœ ๋œจ๊ธฐ ๋•Œ๋ฌธ์— ๋ณด๊ธฐ์— ๋น„๊ต๊ฐ€ ์‰ฝ์Šต๋‹ˆ๋‹ค.

๊ทธ๋ฆฌ๊ณ  ๋…ธ๋ž€์ค„ ์นœ ๋งจ๋ฐ‘ ๋ฐ”์—์„œ ์ปค๋ฐ‹ ์‹œ์ ๊ณผ ๋ธŒ๋Ÿฐ์น˜๋ฅผ ์„ ํƒ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค~~

 

 

 

+ github pr -> merge ๊ฐœ๋… ( ํ˜‘์—… )

fork ์ƒ์„ฑ ํ›„ pull request ํ–ˆ์„ ๋•Œ, master ๋ธŒ๋Ÿฐ์น˜์—์„œ approve mergeํ•˜๋ฉด ๋ณ‘ํ•ฉ๋จ.

(merge ์‹ซ์œผ๋ฉด approve๋Œ€์‹  comment๋งŒ..) 

 

 

 

 

+ git ๊ด€๋ จ ์žฌ๋ฐŒ๋Š” ์˜์ƒ๋„..

 

 

 

LGTM !

 

๊ทธ์™ธ์ถ”๊ฐ€

https://gmlwjd9405.github.io/2018/05/25/git-add-cancle.html

 

 

๋Œ“๊ธ€