Potato
์•ˆ๋…•ํ•˜์„ธ์š”, ๊ฐ์žก๋‹ˆ๋‹ค?๐Ÿฅ” ^___^ ๐Ÿ˜บ github ๋ฐ”๋กœ๊ฐ€๊ธฐ ๐Ÿ‘‰๐Ÿป

Git

[Github] xcode ํ”„๋กœ์ ํŠธ - xcuserdata, xshareddata ํŒŒ์ผ conflict ํ•ด๊ฒฐ

๊ฐ์ž ๐Ÿฅ” 2022. 6. 14. 16:17
๋ฐ˜์‘ํ˜•

์–ด์ œ ์˜ค์ „ ๋‚ด๋‚ด ์ด ์ถฉ๋Œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๋Š”๋ฐ ์‹œ๊ฐ„์„ ์‚ฌ์šฉํ–ˆ๋‹ค. ์™œ ์ถฉ๋Œ์ด ์ƒ๊ฒผ๋Š”์ง€, ์ดˆ๋ฐ˜์— ์–ด๋–ป๊ฒŒ ์ด ์ถฉ๋Œ์„ ์˜ˆ๋ฐฉํ•  ์ˆ˜ ์žˆ๋Š”์ง€ ๊ทธ๋ฆฌ๊ณ  ๋‚˜๋Š” ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐํ–ˆ๋Š”์ง€ ๊ธฐ์–ตํ•˜๊ธฐ ์œ„ํ•ด์„œ ํ•ด๋‹น ํฌ์ŠคํŒ…์„ ํ•˜๋ ค๊ณ  ํ•œ๋‹ค!

 

์ด๋ฒˆ MC2 ํ”„๋กœ์ ํŠธ์—์„œ ๋‚ด๊ฐ€ Github repo๋ฅผ ๋งŒ๋“ค๊ณ , Git์„ ์กฐ๊ธˆ...์ด๋‚˜๋งˆ ์ด๋Œ๊ฒŒ ๋˜์—ˆ๋‹ค. ํ•˜์ง€๋งŒ ๊ทธ๋ ‡๊ฒŒ ํ•˜๊ธฐ์—” ๋‚˜๋Š” git ๊ด€๋ จ ์ง€์‹์ด ํ„ฑ์—†์ด ๋ถ€์กฑํ–ˆ๋‹ค ใ… ใ…  ๊ทธ๋ž˜์„œ ๋‚ด๊ฐ€ ์„ธ์šด ์ด๋ฒˆ MC2 ํ”„๋กœ์ ํŠธ์˜ ์ž‘์€ ๋ชฉํ‘œ ์ค‘ ํ•˜๋‚˜๊ฐ€ ๋ฐ”๋กœ Git MASTER ๋˜๊ธฐ!

 

๐Ÿ– ๊นƒ ๋งˆ์Šคํ„ฐ๊ฐ€ ๋˜๊ธฐ ์œ„ํ•ด์„œ ๋‚ด๊ฐ€ ์„ค์ •ํ•œ ๋ชฉํ‘œ

  • ์ง์ ‘ ํŒ€ repo ๋‚ด๊ฐ€ ๋งŒ๋“ค๊ธฐ
  • .gitignore ์„ค์ •ํ•˜๊ธฐ
  • readme ๋๋‚ด์ฃผ๊ฒŒ ์ž‘์„ฑํ•˜๊ธฐ
  • Issue ์‚ฌ์šฉํ•˜๊ธฐ 
  • code reivew ์ง„ํ–‰ํ•˜๊ธฐ
  • githubdesktop ๋ง๊ณ  terminal๋กœ git ๋ช…๋ น์–ด ์‚ฌ์šฉ ์ตํžˆ๊ธฐ

์ด ๋ชฉํ‘œ๋ฅผ ์ด๋ฃจ๊ธฐ ์œ„ํ•ด์„œ ํŒ€ repo๋ฅผ ์ง์ ‘ ์ƒ์„ฑํ•˜๊ณ , gitignore ํŒŒ์ผ์„ ์ƒ์„ฑํ•˜๋ฉด์„œ ํ”„๋กœ์ ํŠธ๋ฅผ ์‹œ์ž‘ํ–ˆ๋‹ค.

 

๐Ÿ– github์—์„œ ์ƒ๊ธด conflict

ํ‰์†Œ์— github์—์„œ PR์„ ๋‚ ๋ฆฌ๊ณ  merge๋ฅผ ํ•  ๋•Œ, ์ถฉ๋Œ์ด ์ƒ๊ธฐ๋ฉด github ๋‚ด๋ถ€์—์„œ conflict๋ฅผ ํ•ด๊ฒฐํ•˜๊ณ  merge ํ–ˆ์—ˆ๋‹ค.

์ด๋ ‡๊ฒŒ ์ถฉ๋Œ์ด ์ƒ๊ธฐ๋ฉด ์˜ค๋ฅธ์ชฝ์˜ Resolve conflicts ๋ฅผ ํด๋ฆญํ•ด์„œ ํ•ด๊ฒฐํ–ˆ์—ˆ๋‹ค.

 

๊ทผ๋ฐ xcuserdata์™€ ๊ด€๋ จ๋œ ์ถฉ๋Œ์ด๋ฐœ์ƒํ–ˆ์„๋•Œ๋Š” ์ € ๋ฒ„ํŠผ์กฐ์ฐจ ์ƒ๊ธฐ์ง€ ์•Š์•˜๋‹ค. ๊ทธ๋ƒฅ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ณ  ๋‚˜์„œ mergeํ•ด๋ผ ๋ผ๋Š” ์‹์˜ ๋ฉ”์‹œ์ง€ ๋ฟ์ด์—ˆ๋‹ค.

์ด ์„ธ๊ฐœ์˜ ํŒŒ์ผ์—์„œ ์ถฉ๋Œ์ด ๋‚ฌ์—ˆ๊ณ , ์„ธ๊ฐœ ์ „๋ถ€ jisoo.pos.scuserdataed์˜€๋‹ค. ํ•ด๋‹น ํŒŒ์ผ์ด ์ด ์„ธ๊ตฐ๋ฐ์— ๋“ค์–ด๊ฐ€ ์žˆ์—ˆ์–ด์„œ, ์„ธ๊ตฐ๋ฐ์—์„œ conflict๊ฐ€ ๋‚ฌ๋‹ค.

 

๐Ÿ– ์–ด๋””์„œ ๋ถ€ํ„ฐ ๋ฌธ์ œ๊ฐ€ ๋๋Š”๊ฐ€?

์ € ํŒŒ์ผ์€ ๊ฐœ์ธ์ด local์—์„œ xcode ํ”„๋กœ์ ํŠธ๋ฅผ ๋นŒ๋“œํ• ๋•Œ๋งˆ๋‹ค ๊ฐฑ์‹ ๋˜์–ด ์ƒ์„ฑ๋˜๋Š” ํŒŒ์ผ์ด๋ผ๊ณ  ํ•œ๋‹ค. ์ œ์ผ ์ฒ˜์Œ์— ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค์–ด์„œ repo๋ฅผ ์ƒ์„ฑํ•œ ์‚ฌ๋žŒ์ด ๋‚˜์ด๊ธฐ ๋•Œ๋ฌธ์—, ๋‚˜์˜ ๊ฐœ์ธ ๋ฐ์ดํ„ฐ๊ฐ€ ๋“ค์–ด๊ฐ€๋ฒ„๋ฆฐ ๊ฒƒ์ด๋‹ค.

๊ทธ๋ž˜์„œ ํ•ด๋‹น main ๋ธŒ๋žœ์น˜์—์„œ pull์„ ๋ฐ›์•„์„œ ์ž‘์—…ํ•˜๋˜ ๋ชจ๋“  ํŒ€์›๋“ค์˜ local์—๋„ ์ € ํŒŒ์ผ๋“ค์ด ๋“ค์–ด๊ฐ€ ์žˆ๋˜ ์ƒํƒœ์˜€๋‹ค. ๊ทธ๋ž˜์„œ ์ž๊พธ ํŒ€์›๋“ค๊ณผ ๋‚ด๊ฐ€ commit์„ ์˜ฌ๋ฆด ๋•Œ๋งˆ๋‹ค jisoo.pos ํŒŒ์ผ์—์„œ ์ถฉ๋Œ์ด ๋‚ฌ๋˜ ๊ฒƒ์ด๋‹ค.

 

๐Ÿ– .gitignore ์„ค์ •์ด ์ž˜๋ชป๋๊ตฌ๋‚˜?

ํ•ด๋‹น xcuserdata ํŒŒ์ผ์ด git์—์„œ ์ถ”์ ์ด ๋˜์ง€ ์•Š๋„๋ก gitignore์— ์„ค์ •ํ–ˆ์–ด์•ผ ํ–ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋‚œ ๊ทธ ๊ณผ์ •์„ ์ดˆ๋ฐ˜์— ํ•˜์ง€ ์•Š์•˜๊ธฐ ๋•Œ๋ฌธ์—, ๋‚ด ๋กœ์ปฌ์—์žˆ๋Š” ๋ชจ๋“ ๊ฒƒ์ด ์˜ฌ๋ผ๊ฐ€๋ฒ„๋ฆฐ ๊ฒƒ์ด๋‹ค. 

https://www.toptal.com/developers/gitignore

 

gitignore.io

Create useful .gitignore files for your project

www.toptal.com

์—ฌ๊ธฐ ๋“ค์–ด๊ฐ€๋ฉด ํ‚ค์›Œ๋“œ๋ฅผ ์ ์–ด์„œ ๊ด€๋ จ๋œ gitignore ๋ชฉ๋ก๋“ค์„ ์‰ฝ๊ฒŒ ๋ฐ›์•„๋ณผ ์ˆ˜ ์žˆ๋‹ค. ์—ฌ๊ธฐ์„œ xcode๋ฅผ ๋„ฃ์—ˆ์–ด์•ผ ํ•˜๋Š”๋ฐ,, ๋„ฃ์ง€ ์•Š์•˜๋˜ ๊ฒƒ์ด๋‹ค.

# Created by https://www.toptal.com/developers/gitignore/api/xcode
# Edit at https://www.toptal.com/developers/gitignore?templates=xcode

### Xcode ###
## User settings
xcuserdata/

## Xcode 8 and earlier
*.xcscmblueprint
*.xccheckout

### Xcode Patch ###
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcworkspace/contents.xcworkspacedata
/*.gcno
**/xcshareddata/WorkspaceSettings.xcsettings

# End of https://www.toptal.com/developers/gitignore/api/xcode

์ด๊ฑธ.. ์•ˆ๋„ฃ์—ˆ๋‹ค.๊ทธ๋ž˜์„œ userdata๊ฐ€ ์ถ”์ ๋˜๋˜ ์ƒํ™ฉ ใ… ใ…  

 

๐Ÿ– ํ•ด๊ฒฐ๋ฐฉ๋ฒ•

์šฐ์„ , ์ด๋ฏธ ๋ชจ๋“  ์‚ฌ๋žŒ๋“ค์˜ local์— ์ž˜๋ชป๋œ .gitignore์ด ๋“ค์–ด๊ฐ€์žˆ๊ณ , ์ด๋ฏธ ๋‚ด xcuserdata๊ฐ€ ๋ชจ๋‘ ๋“ค์–ด๊ฐ€์žˆ๊ธฐ ๋•Œ๋ฌธ์— main์—์„œ gitignore๋งŒ ์ˆ˜์ •ํ•œ๋‹ค๊ณ  ํ•ด๊ฒฐ๋  ๋ฌธ์ œ๊ฐ€ ์•„๋‹ˆ์—ˆ๋‹ค. 

๊ทธ๋ž˜์„œ  ๋‚˜๋Š” ์กฐ๊ธˆ ,, ์ˆ˜๊ณ ์Šค๋Ÿฝ์ง€๋งŒ ๋ชจ๋“  ๋ธŒ๋žœ์น˜์™€ ํŒ€์›๋“ค์˜ ๋กœ์ปฌ์—์„œ ์ „๋ถ€ xcuserdata ํŒŒ์ผ์„ ์ฐพ์•„์„œ ์‚ญ์ œํ•ด์„œ ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ๋กœํ–ˆ๋‹ค.

 

์•„๋ž˜ ์‚ฌ์ง„์„ ๋ณด๋ฉด, xcuserdataํŒŒ์ผ์ด ์žˆ์„ ๋‹น์‹œ, ๋งŒ๋“ค์–ด์ง„ ๋ชจ๋“  ๋ธŒ๋žœ์น˜์— ์ €๋Ÿฌํ—ฅ ํŒŒ์ผ๋“ค์ด ์กด์žฌํ–ˆ๋‹ค. ํ•ด๋‹น ํŒŒ์ผ๋“ค์„ ์ „๋ถ€ ์ˆ˜๊ธฐ๋กœ delete directory ๋ฅผ ํ•ด์ฃผ์—ˆ๋‹ค. ๋ชจ๋“ .. ๋ธŒ๋žœ์น˜ ์ „๋ถ€..

 

๊ทธ๋ฆฌ๊ณ  ์ด๋ ‡๊ฒŒ๋งŒ ํ•ด๋„, ์–ด์ฐจํ”ผ ํŒ€์›๋“ค์˜ ์ปดํ„ฐ ๋‚ด๋ถ€์—์„œ ๋˜ commitํ• ๋•Œ xcuserdata๊ฐ€ ๋”ธ๋ ค์˜ฌ๋ผ์˜ฌ๊ฑฐ๋ผ์„œ , ํŒ€์›๋“ค์˜ ๋…ธํŠธ๋ถ์„ ์ž ๊น ๋‹ฌ๋ผ๊ณ ํ•ด์„œ ํŒ€์›๋“ค์˜ ๋กœ์ปฌ์—์„œ๋„ ์ „๋ถ€ jisoo.pos (๋‚˜์˜ xcuserdata)๋ฅผ ์‚ญ์ œํ•ด์ฃผ์—ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์‚ญ์ œ๋‚ด์—ญ์„ commit..

 

๊ทธ๋ฆฌ๊ณ  ํŒ€์›๋“ค์˜ gitignore์„ ์ „๋ถ€ ์ƒˆ๋กœ ์—…๋ฐ์ดํŠธํ•ด์ฃผ๊ณ , main์˜ gitignore์„ ์—…๋ฐ์ดํŠธ ํ•ด์ฃผ์—ˆ๋‹ค. 

 

 

 

์•ž์œผ๋กœ๋Š”...gitignore ์ž˜ ์„ค์ •ํ•˜๊ณ  ์‹ ์ค‘ํ•˜๊ฒŒ repo๋ฅผ ๋งŒ๋“ค์–ด์•ผ๊ฒ ๋‹ค.... 

๋ฐ˜์‘ํ˜•