반응형

[깃 명령어]
git init - 레지포지트리 초기화
git --versoin - 깃 버전 확인
git status - 프로젝트가 깃으로 관리되는지를 확인
git add 파일명 - 추적해야할 파일을 추가
git commit -m "added text.txt file"   -   커밋을 하고 메세지 추가
git config --global --edit   -  깃이 내 컴퓨터의 사용자 계정용으로 
                                              생성한 정보( Esc 누르고 :x 치면 돌아감)
git config --global user.name - 깃  구성 정보를 변경하는 명령어
                                  global은 내가 방금 추가한 개인 정보를 의미
                                  user.name은 현재 사용자 이름 나타냄
                                  user.email은 이메일 
git config --global user.name "바꿀 이름" - 사용자 이름 바꿔짐
git log - 마스터 브랜치 안에 있는 모든 커밋들의 개요를 볼 수 있음
git branch - 우리가 작업하고 있는 프로젝트 메인코드를 잡는 
                    브랜치를 보여줌
git checkout -b 브랜치명  -  새로운 브랜치 만듬
git merge - 브랜치 병합
git reset --hard HEAD~1   - 마지막에 저장된곳으로 리셋

 

PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git init
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> % git init
% : null 값 식에서 메서드를 호출할 수 없습니다.
위치 줄:1 문자:1
+ % git init
+ ~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:PSObject) [ForEach-Object], PSArgumentException
    + FullyQualifiedErrorId : InvokeMethodOnNull,Microsoft.PowerShell.Commands.ForEachObjectCommand
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git --version
git version 2.40.1.windows.1
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git status
On branch main

No commits yet

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        test.txt

nothing added to commit but untracked files present (use "git add" to track)
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git add test.txt
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git status      
On branch main

No commits yet

Changes to be committed:
  (use "git rm --cached <file>..." to unstage)
        new file:   test.txt

 

 

PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git commit -m "added text.txt file"
[main (root-commit) 94e8e75] added text.txt file
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 test.txt
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git config --global --edit  
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git config --global user.name
leelife96
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git config --global user.name "Manuel Lorenz"
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git config --global user.name
Manuel Lorenz
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git config --global user.name "leelife96"

PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git status
On branch main
nothing to commit, working tree clean
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics> git log
commit 94e8e75d67c9e967b766f65dffa6dc27d7c32bfc (HEAD -> main)
Author: leelife96 <leelife77@naver.com>
Date:   Tue Jul 25 21:45:13 2023 +0900

    added text.txt file
PS C:\Users\leeli\OneDrive - 메이머스트\바탕 화면\git-basics>

+ Recent posts