Skip to content

๐Ÿ‘ป git ์ด์Šˆ ์ƒํ™ฉ ์ •๋ฆฌ ๐Ÿ˜…ย #15

@seungyeub

Description

@seungyeub

git ์ด์Šˆ ์ƒํ™ฉ ์ •๋ฆฌ

  1. [git pull error](#git pull error)
  2. [๊ธฐ์กดํ”„๋กœ์ ํŠธ repository์— ์˜ฌ๋ฆฌ๊ธฐ](#๊ธฐ์กดํ”„๋กœ์ ํŠธ repository์— ์˜ฌ๋ฆฌ๊ธฐ)
  3. [merge ์‹ค์ˆ˜๋กœ ๋ฐ์ดํ„ฐ ๋‚ ์•„๊ฐ”์„ ๋•Œ / git reflog](#merge ์‹ค์ˆ˜๋กœ ๋ฐ์ดํ„ฐ ๋‚ ์•„๊ฐ”์„ ๋•Œ / git reflog)

git pull error

  • github์— ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ๋ฅผ ํ‘ธ์‹œํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜์™€ ๊ฐ™์ด pull ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ–ˆ์„ ๋•Œ ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ•จ.
> git pull origin master
-- fatal: refusing to merge unrelated histories
  • ์ด๋Ÿด ๊ฒฝ์šฐ ์•„๋ž˜์™€ ๊ฐ™์ด ์˜ต์…˜์„ ์ฃผ์–ด pull ๋ฐ›๋„๋ก ํ•˜์ž
> git pull origin <<branch name>> --allow-unrelated-histories
  • ์—๋Ÿฌ๊ฐ€ ๋‚˜๋Š” ์ด์œ 
"git merge" used to allow merging two branches that have no common base by default, 
which led to a brand new history of an existing project created and then get pulled 
by an unsuspecting maintainer, which allowed an unnecessary parallel history 
merged into the existing project. The command has been taught not to allow this 
by default, with an escape hatch "--allow-unrelated-histories" option to be used in 
a rare event that merges histories of two projects that started their lives independently.

http://stackoverflow.com/questions/37937984/git-refusing-to-merge-unrelated-histories


๊ธฐ์กดํ”„๋กœ์ ํŠธ repository์— ์˜ฌ๋ฆฌ๊ธฐ

> git init
> git add .
> git commit -m "Initial commit"
> git remote add origin <<repository url>>.git
> git push origin master

> git id(e-mail)/password ์ž…๋ ฅ

merge ์‹ค์ˆ˜๋กœ ๋ฐ์ดํ„ฐ ๋‚ ์•„๊ฐ”์„ ๋•Œ / git reflog

  • merge ํ˜น์€ rebase ์ค‘ ์‹ค์ˆ˜๋กœ ๋‚ด๊ฐ€ ์ž‘์—…ํ•œ ํŒŒ์ผ์„ ๋ฎ์–ด์ผ์„ ๋•Œ ๐Ÿ˜ต๐Ÿ˜ฑ๐Ÿฅถ
> git reflog --date=iso

๋กœ commit log๋ฅผ ํ™•์ธํ•˜๊ณ  rollbackํ•œ commit log๋กœ checkout ํ•ด์ค€ ํ›„ ๋‹ค์‹œ ๋Œ๋ ค ๋†“๋Š”๋‹ค.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions