Programing

git로 파일을 어떻게 커밋 할 수 있습니까?

lottogame 2020. 11. 1. 17:11
반응형

git로 파일을 어떻게 커밋 할 수 있습니까?


어떤 튜토리얼도 도움이되지 않습니다!
그들은 모두 내가 무엇을 해야할지 안다고 생각하는 곳에서 그 일을합니다 ..

현재 내 터미널 창은 ..

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       deleted:    httpdocs/newsite/manifest/cache/0a432970ba6491fe65dad60b012e5c95_louloumay2011en-1-4dea3186b7f7b.jpg
#       deleted:    httpdocs/newsite/manifest/cache/0a61b5d7a9e97da78fe602e1ad41edb6_5-4dec7c3d57c80.jpg
#       deleted:    httpdocs/newsite/manifest/cache/0afb6a7716a85d0de46cdd03bb30f75f_fifa_panorama_full_page-01_thu-4dea3d1a0e0f5.jpg
#       deleted:    httpdocs/newsite/manifest/cache/0b3bc9be76a5d3e1e36af4b8dcf98658_free2-4df0e2e08761f.jpg
#       deleted:    httpdocs/newsite/manifest/cache/0b6342913b8e599fac76da452af98ec5_si-feb-2009-1-4dea3d1abcb61.jpg
#       deleted:    httpdocs/newsite/manifest/cache/0b9ddc587340f7744e03c4b2dafacf7f_lou-lou-winter-2009-cover-4dea3d1a9b1a0.jpg
#       deleted:    httpdocs/newsite/manifest/cache/0bf64ff8fc22720b3da20d0730fa6a04_chatelaine-dec-2009-4dea3d18daa30.jpg
#       deleted:    httpdocs/newsite/manifest/cache/0bf664e03eb0a2255b69b02aed85add0_summumfeb2011-2-4dea3188766aa.jpg

하지만 여기에서는 그들이 말하는 것을 어떻게 할 수 있는지 알 수있는 방법이 없습니다.
http://learn.github.com/p/normal.html

그것이 말하는 것은

커밋 메시지를 입력하고 편집기를 종료하면됩니다.

그게 무슨 뜻이야?!
단어를 쓴다고 해서 단순하다는 의미는 아닙니다 ..

입력을 시작하면 "녹음"또는 "삽입"이라고 말하는 이상한 내용이 표시되고 약 300 개의 파일이 있으며 모든 줄을 메시지로 바꾸길 원합니다?!?

도와주세요!

이를 위해 편리한 Mac 응용 프로그램을 사용하지만 파일이 20 개 이상이면 작동이 멈 춥니 다!
무슨 일이야 ??


git commit인수없이 실행 하면 커밋 메시지를 입력 할 수있는 기본 편집기가 열립니다. 파일을 저장하고 편집기를 종료하면 커밋됩니다.

기본 편집기가 Vi 또는 Vim 인 것 같습니다. 입력 할 때 "이상한 것"이 발생하는 이유는 Vi가 삽입 모드에서 시작되지 않기 때문입니다. 먼저 i키보드 를 눌러야 합니다! 원하지 않는 경우 다음과 같이 더 간단한 것으로 변경할 수 있습니다.

git config --global core.editor nano

그런 다음 커밋 할 때 Nano 편집기를로드합니다 (설치되어 있다고 가정합니다!). Vi와 같은 모달 편집기를 사용하지 않은 사용자에게는 훨씬 더 직관적입니다.

화면에 표시되는 텍스트는 커밋하려는 내용을 상기시키기위한 것입니다. 이 줄은 #주석이라는 뜻입니다. 즉, 커밋 메시지를 저장할 때 Git은 해당 줄을 무시합니다. 파일별로 메시지를 입력 할 필요가 없습니다. 편집기의 버퍼 상단에 텍스트를 입력하면됩니다.

편집기를 우회하려면 커밋 메시지를 인수로 제공 할 수 있습니다.

git commit -m "Added foo to the bar"

여기에 유일한 문제는 시작됩니다 기본 편집기는 점이다 것처럼 소리 vivim,있는 당신이 익숙하지. (빠른 팁으로, 변경 사항을 저장하지 않고 그 편집기를 종료 칠 Esc을 몇 번 한 후 입력 :, q, !Enter.)

기본 편집기를 설정하는 방법에는 여러 가지가 있으며 사용중인 운영 체제를 지정하지 않았으므로 특별히 권장하는 것이 어렵습니다. 다음을 사용하는 것이 좋습니다.

 git config --global core.editor "name-of-your-editor"

... 특정 편집기에 대한 전역 git 기본 설정을 설정합니다. 또는 $EDITOR환경 변수를 설정할 수 있습니다 .


시스템 환경을 모르지만 다음을 입력 한 것 같습니다.

git commit

그리고 기본 편집기가 시작되었습니다. 최악의 경우 (당신에게) 그것은 vim 일 수 있습니다 :)

vim을 종료하는 방법을 모른다면 : q를 사용하십시오.

추가 문제가 있으면 다음을 사용할 수 있습니다.

git commit -m 'Type your commit message here'

이 상황에서 표준 Vi 편집기에서

  1. Esc를 누르십시오.
  2. ": wq"유형 (따옴표 제외)
  3. 엔터 키를 치시오

변경된 모든 파일을 커밋하는 명령 :

git commit -a -m 'My commit comments'

-a = 편집 된 모든 파일

-m = 다음 문자열은 주석입니다.

This will commit to your local drives / folders repo. If you want to push your changes to a git server / remotely hosted server, after the above command type:

git push

GitHub's cheat sheet is quite handy.


Git uses "the index" to prepare commits. You can add and remove changes from the index before you commit (in your paste you already have deleted ~10 files with git rm). When the index looks like you want it, run git commit.

Usually this will fire up vim. To insert text hit i, <esc> goes back to normal mode, hit ZZ to save and quit (ZQ to quit without saving). voilà, there's your commit


This happens when you do not include a message when you try to commit using:

git commit

It launches an editor environment. Quit it by typing :q! and hitting enter.

It's going to take you back to the terminal without committing, so make sure to try again, this time pass in a message:

git commit -m 'Initial commit'

It looks like all of the edits are already a part of the index. So to commit just use the commit command

git commit -m "My Commit Message"

Looking at your messages though my instinct says that you probably don't want the cache files to be included in your depot. Especially if it something that is built on the fly when running your program. If so then you should add the following line to your .gitignore file

httpdocs/newsite/manifest/cache/*

I faced the same problem , i resolved it by typing :q! then hit Enter And it resolved my problem After that run the the following command git commit -a -m "your comment here"

This should resolve your problem.

참고URL : https://stackoverflow.com/questions/7080803/how-can-i-commit-files-with-git

반응형