1. rebase를 이용한 author 및 commit 내용 변경

 

$ git rebase -i --root						# --root : 처음부터 끝까지
$ # git rebase -i 824a488df15c65176559797364f575ebe51d5f98	# hash값 넣을시 최신으로부터 hash값 전부터 시작
$ # vi가 열리면 :%s/pick/e 변경 후 :wq

$ git commit --no-edit --amend --author="whatman <whatman@google.com>"
$ git rebase --continue
$ git commit --no-edit --amend --author="whatman <whatman@google.com>"
$ git rebase --continue
$ #				.... 계속 반복
$ git commit --amend --author="whatman <whatman@google.com>"	#  commit 내용 변경하고 싶을 시
$ git push origin +master					# +master : force push

'Git' 카테고리의 다른 글

Git repository 옮기기 및 통합 Git repository (history 유지)  (0) 2021.11.08
유용한 Git 명령어 정리  (0) 2021.11.02

1. Git Repository 그대로 옮기기

A : 이동할 원본 Repogitory

B : 새로 만든 이동될 Repogitory

$ git clone --mirror ${A Repogitory URl}.git
$		### EX) git clone --mirror http://192.168.1.11:9988/test/test.git
$ cd ${A Repogitory name}
$ git remote set-url --push origin ${B Repogitory URL}.git
$ git push --mirror

 

proxy error 발생 시

 

$ git config --global --unset http.proxy
$ git config --global http.sslVerify false

 

 

2. 여러개의 Git Repository를 하나로 통합 방법

A, B : 원본 Repogitory 

M : 새로 만든 이동될 Repogitory

$ git clone ${M Repogitory URl}
$ cd ${M Repogitory name}
$ git remote add ${brach_name} ${A Repogitory URl}
$		### EX) git remote add repo_A http://192.168.1.11:9988/test/test.git
$ git fetch ${brach_name}
$ git merge --allow-unrelated-histories ${brach_name}/master
$ git push


$ git remote add ${brach_name} ${B Repogitory URl}
$		### EX) git remote add repo_B http://192.168.1.11:9988/test/test.git
$ git fetch ${brach_name}
$ git merge --allow-unrelated-histories ${brach_name}/master
$ git push

계속해서 merge하면서 통합을 진행 하면 된다.

 

 * tags push

$ git push --tags
$ git push --all	#branch push

 

3. gitlab에서 data repogitories에서 Push Test

 

https://www.lesstif.com/gitbook/github-default-master-main-100205686.html

 

github default 브랜치명을 master 에서 main 으로 변경하기

local 에 저장소를 clone 한 경우 다음과 같이 기본 저장소 이름을 바꿔줘야 합니다. git branch -m master main git fetch origin git branch -u origin/main main BASH

www.lesstif.com

$ git remote -v			# 확인
$ git remote remove ${branch}	# remove
$ git remote add master {Repogitory URL}
$ git fetch master
$ git push --set-upstream master master --force
$ git push --tags

 

 

'Git' 카테고리의 다른 글

Git commit push 내용 변경  (0) 2022.04.29
유용한 Git 명령어 정리  (0) 2021.11.02

■ 초기 Setting
git clone https://github.com/Whatmam/InCu6Q.git
git add Filesystem
git commit -m "ADD QT5"
git branch -M main
git push -u origin main


■ 리모트 저장소 확인하기
git remote -v

■ Branch 이동
git checkout (branch name)
git checkout develop            -> develop해서 사용하고 commit.. 후 master에게 merge 요청하여 사용이 좋음
git branch ->현재 branch 확인


※ repository의 branch , git clone에서 생성한 branch는 다르다. working repo -> remote repo로 적용시켜야함.

 

참고:  https://goddaehee.tistory.com/274

 - branch 생성
git branch test
 - branch로 이동
git checkout test
 - branch 생성 + 이동
git branch -b test
 - 생성한 Branch를 원격 Repository에 push 하기
git push --set-upstream origin test


■ Update
git pull ->현재 branch의 최신 업데이트
git pull origin (branch name) -> branch에 대한 업데이트


■ 수정 사항 확인 하기
git diff

■ push한 message 수정
1. git commit --amend
2. 수정
3. git push --force

■push 취소
git reset [체크섬]
git commit 
git push orign main -f (강제 push)

■push전 commit 돌리기
git log로 commit 체크섬 확인
git reset [체크섬]

■git tag로 download 
1. git clone -b upstream/6.2.4.p4.0 https://github.com/Freescale/kernel-module-imx-gpu-viv.git

2. git clone https://github.com/Freescale/kernel-module-imx-gpu-viv.git
git checkout upstream/6.2.4.p4.0

X git pull https://github.com/Freescale/kernel-module-imx-gpu-viv.git upstream/6.2.4.p4.0 이건 아님 최신에서 pull 하기에 이미 적용되어 있어서 안됨.

3. git clone https://github.com/Freescale/kernel-module-imx-gpu-viv.git
git reset --hard upstream/6.2.4.p4.0 reset으로 간다.

 

■ git tag

 - 테그 생성
git tag v1.0.0
git tag
git show v1.0.0

 - 원격 저장소의 테그 올리기
git push origin v1.0.0

 - 원격 저장소의 테그 삭제
git push origin :v1.0.0

 

 

■ project 히스토리까지 모두 복사하는 방법
git clone --mirror  git clone https://chs0517@106.251.230.25:28443/r/apps/test.git
cd sw_cowork.git/
git remote set-url --push origin http://106.251.230.24:9988/whatmam/test.git
git push --mirror 


■ error 시 

git config --global --unset http.proxy
git config --global http.sslVerify false

 

 -- git reset 하는법

https://sehajyang.github.io/tip/2019/03/11/git-reset-push.html/

'Git' 카테고리의 다른 글

Git commit push 내용 변경  (0) 2022.04.29
Git repository 옮기기 및 통합 Git repository (history 유지)  (0) 2021.11.08

+ Recent posts