Pycharm 에서 commit을 하는데, git 계정이 두 개여서 다른 user로 바꾸고 싶었다..!

 

 

 

다른 계정으로 commit을 하니까 메인 계정에서 git contribution에 반영되지 않았기 때문!!! 실제 한 달 간 django project를 하면서 commit을 굉장히 많이 했는데 하나도 반영이 안됐다! ㅜㅜ

 

방법

pycharm 터미널에서 간단한 명령어를 통해 해결할 수 있었다!

(venv) git config user.name
[현재 유저이름]
(venv) git config user.email
[현재 이메일주소]
(venv) git config --local user.email [바꾸고 싶은 이메일 주소]

 

나의 경우에는 ... 이메일 주소만 바꾸니 원하는 계정 정보로 이용할 수 있었다! (알고보니, 이메일 주소를 바꿔서 다른 계정으로 연결되었던 것... 같다...ㅎ) 

 

'Git > 개인' 카테고리의 다른 글

[Git 관리] commit 취소하기  (0) 2020.11.02
[Git 관리] Git 이전 commit으로 돌아가는 방법  (0) 2020.10.29

WRITTEN BY
choco-songyi

,

방법 두가지

- git reset

  - git reset --hard ...

  - git reset --soft ...

- git revert

 

상태& 하고 싶었던 것 

- 커밋했지만, 아직 push하지 않았음.

- 이전 커밋을 취소하고 리드미를 변경하여 커밋하고 싶음.

 

선택한 방법 

- git reset --soft HEAD~1

 

참고

gitabout.com/8

 

Git commit 되돌리기 명령어 Reset 과 Revert

Git 커밋(commit) 이력 되돌리기 이미 커밋(commit)된 작업 이력을 이전으로 되돌려야 하는 상황은 항상 발생합니다. 작업중에 실수로 올라간 커밋일 수 도 있고 버그나 오류가 포함된 커밋 일수도 있

gitabout.com

 

'Git > 개인' 카테고리의 다른 글

[Git 관리] user 변경하기  (0) 2020.11.10
[Git 관리] Git 이전 commit으로 돌아가는 방법  (0) 2020.10.29

WRITTEN BY
choco-songyi

,

 

[오류1]

Please commit your changes or stash them before you merge.
Aborting

[해결1]

git stash (local에서 하던 것을 잠시 미뤄두기)

(venv) C:\Users\user\PycharmProjects\DjangoProject\insta>git stash
Saved working directory and index state WIP on master: 6edaaf5 UpdateForm 조금 변경 !

 다시 pull을 해보자!


[오류2]

warning: Cannot merge binary files: db.sqlite3 (HEAD vs. eb7f395a92448ac8dddd762c0c997093207cc88d)
Auto-merging member/forms.py
CONFLICT (content): Merge conflict in member/forms.py
Auto-merging db.sqlite3
CONFLICT (content): Merge conflict in db.sqlite3
Automatic merge failed; fix conflicts and then commit the result.

[해결2]

DB를 지워보자!


[오류3]

(venv) C:\Users\user\PycharmProjects\DjangoProject\insta>git pull
error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.

[해결3] 

1. git status 를 통해 unmerged path를 확인한다.

Unmerged paths:
  (use "git add <file>..." to mark resolution)

        both modified:   member/forms.py

2. git add 파일명

(venv) C:\Users\user\PycharmProjects\DjangoProject\insta>git add member/forms.py

3. git commit am "커밋메시지"

(venv) C:\Users\user\PycharmProjects\DjangoProject\insta>git commit -am "am commit"
[master 2876f19] am commit

(venv) C:\Users\user\PycharmProjects\DjangoProject\insta>git pull
Already up to date.

[결과]

pull 성공 :)

 

 

 

[결론]

git 오류날때 오류 메시지 구글링해서 시키는 대로 해보자! ...ㅎㅎ

 

[참고]

ayong8.tistory.com/entry/git-stash-%EC%A7%81%EA%B4%80%EC%A0%81%EC%9C%BC%EB%A1%9C-%EC%9D%B4%ED%95%B4%ED%95%98%EA%B8%B0

 

git stash: 직관적으로 이해하기

git stash의 직관적 이해 직관적 이해 기본적으로 git stash는 현재 업데이트된 내용을 스택에 치워두는 명령어다 내 로컬의 modified, staged contents들을 (=나의 변경사항을) 스택구조 (한켠에 설정되어

ayong8.tistory.com

jmlim.github.io/git/2019/02/18/git-pull-fail-problem/

 

git merge 후 pull 실패 시 해결 방안 - You have not concluded your merge (MERGE_HEAD exists) · 기억하기 위한 개

커밋을 제대로 하지 않았을 경우 아래 메세지가 뜰 수 있음. Pulling is not possible because you have unmerged files

jmlim.github.io

 


WRITTEN BY
choco-songyi

,

1. git checkout HEAD~{n번째 전}

(venv) C:\Users\user\PycharmProjects\DjangoProject\insta>git checkout HEAD~1
Note: checking out 'HEAD~1'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

HEAD is now at 5ba51da little change
M       api/__pycache__/__init__.cpython-38.pyc
M       api/__pycache__/urls.cpython-38.pyc
# ...생략...

- 결과 : HEAD가 바로 이전 커밋으로 돌아갔음. 

- 확인 : 이전 커밋 해시번호 (5ba51da5)로 돌아갔음

2. 체크아웃했더니 서버로부터의 pull이 또 실패...ㅎㅎ => master로 다시 돌아오자...

(venv) C:\Users\user\PycharmProjects\DjangoProject\insta>git checkout master
Previous HEAD position was 5ba51da little change
Switched to branch 'master'
# ---생략----

Your branch and 'origin/master' have diverged,
and have 1 and 5 different commits each, respectively.
  (use "git pull" to merge the remote branch into yours)

 

'Git > 개인' 카테고리의 다른 글

[Git 관리] user 변경하기  (0) 2020.11.10
[Git 관리] commit 취소하기  (0) 2020.11.02

WRITTEN BY
choco-songyi

,