"Git"의 두 판 사이의 차이

ph
이동: 둘러보기, 검색
 
(같은 사용자의 중간 판 6개는 보이지 않습니다)
1번째 줄: 1번째 줄:
 +
== Port 22: Connection timed out ==
 +
set port to 443 (<code>.ssh/config</code>)
 +
Host github.com
 +
Hostname ssh.github.com
 +
Port 443
 +
[https://stackoverflow.com/a/52817036/766330]
 +
 +
== Clone submodule at already cloned repo ==
 +
git clone git://github.com/foo/bar.git
 +
cd bar
 +
git submodule update --init —recursive
 +
[https://stackoverflow.com/a/4438292/766330]
 +
 +
== Duplicating a repository ==
 +
git clone --bare https://github.com/exampleuser/old-repository.git
 +
cd old-repository.git
 +
git push --mirror https://github.com/exampleuser/new-repository.git
 +
cd ..
 +
rm -rf old-repository.git
 +
 +
--bare와 --mirror가 핵심. refer [https://help.github.com/articles/duplicating-a-repository/ github help]
 +
 
==Remove a file from a Git repository without deleting it from the local filesystem==
 
==Remove a file from a Git repository without deleting it from the local filesystem==
 
  git rm --cached mylogfile.log
 
  git rm --cached mylogfile.log
14번째 줄: 36번째 줄:
 
  git pull upstream master && git push origin master
 
  git pull upstream master && git push origin master
 
http://stackoverflow.com/a/5181968/766330
 
http://stackoverflow.com/a/5181968/766330
 +
 +
==remote주소 알아내기==
 +
If referential integrity has been broken:
 +
git config --get remote.origin.url
 +
If referential integrity is intact:
 +
git remote show origin
 +
If you want to use the value in the script, you would use the first command.
 +
 +
https://stackoverflow.com/a/4089452/766330
 +
  
 
==remote 주소 변경==
 
==remote 주소 변경==
24번째 줄: 56번째 줄:
 
http://stackoverflow.com/a/10168693/766330
 
http://stackoverflow.com/a/10168693/766330
  
==a==
+
==로컬 무시하고 pull==
 +
git reset --hard
 +
git pull
 +
로컬을 아예 지우지는 않는 방법
 +
git stash
 +
git pull
 +
git stash pop
 +
http://stackoverflow.com/a/4157261/766330
 +
 
 +
==(git push) matching vs simple==
 +
push all branches
 +
git config --global push.default matching
 +
 
 +
push only the current branch
 +
git config --global push.default simple
 +
 
 +
[https://stackoverflow.com/a/21865319/766330 출처]

2020년 3월 4일 (수) 21:16 기준 최신판

Port 22: Connection timed out

set port to 443 (.ssh/config)

Host github.com
Hostname ssh.github.com
Port 443

[1]

Clone submodule at already cloned repo

git clone git://github.com/foo/bar.git
cd bar
git submodule update --init —recursive

[2]

Duplicating a repository

git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
git push --mirror https://github.com/exampleuser/new-repository.git
cd ..
rm -rf old-repository.git

--bare와 --mirror가 핵심. refer github help

Remove a file from a Git repository without deleting it from the local filesystem

git rm --cached mylogfile.log

For a directory:

git rm --cached -r mydirectory

http://stackoverflow.com/a/1143800/766330

가져와서 새로운 repo만들기

  1. Create a new repo at github.
  2. Clone the repo from the-origin to your local machine.
  3. git remote rename origin upstream
  4. git remote add origin url-of-mine
  5. git push origin master

To pull in patches from upstream, simply run

git pull upstream master && git push origin master

http://stackoverflow.com/a/5181968/766330

remote주소 알아내기

If referential integrity has been broken:

git config --get remote.origin.url

If referential integrity is intact:

git remote show origin

If you want to use the value in the script, you would use the first command.

https://stackoverflow.com/a/4089452/766330


remote 주소 변경

git remote set-url origin git@github.com:USERNAME/OTHERREPOSITORY.git

확인

git remote -v

Update submodule

git submodule update --recursive

http://stackoverflow.com/a/10168693/766330

로컬 무시하고 pull

git reset --hard
git pull

로컬을 아예 지우지는 않는 방법

git stash
git pull
git stash pop

http://stackoverflow.com/a/4157261/766330

(git push) matching vs simple

push all branches

git config --global push.default matching

push only the current branch

git config --global push.default simple

출처