서론(Introduction)
Git graph를 이용하여 버전 관리하는 방법을 배워보도록 하겠습니다. Source control에서 그래프 모양의 버튼을 클릭하거나 window 하단의 'Git Graph'을 클릭하여 Git graph에 접근할 수 있습니다.
Let's learn how to manage versions using Git graph. You can access the Git graph by clicking on the button with a graph icon in the Source Control panel or by clicking on 'Git Graph' at the bottom of the window.
Git graph에 접근하면 다음과 같은 화면을 확인할 수 있습니다.
When accessing the Git graph, you will see the following screen.
Interface
각 영역의 설명은 다음과 같습니다.
1. 지금까지 Push한 commit들 시각화하여 보여줍니다.
2. 현재 다루고 있는 Commit과 그의 message를 나타냅니다. ('Current branch'라고 합니다.) (Check out으로 다른 Commit으로 이동할 수 있습니다. 본 강의에서는 다루지 않습니다. )
3. 각 Commit이 Push된 날짜와 Push한 사람 그리고 Commit의 고유 번호를 나타내줍니다.
Here is an explanation of each section:
1. It visualizes the commits that have been pushed so far.
2. It represents the current commit being discussed along with its message. (It is referred to as the 'Current branch'.) (You can use "Check out" to move to a different commit, but we won't cover that in this tutorial.)
3. It displays the date and author of each pushed commit, along with a unique identifier for each commit.
변경사항 확인(Review of changes)
변경사항을 확인하고 싶은 Commit을 클릭하면 다음과 같은 화면을 확인할 수 있습니다. 파일명의 색깔의 의미는 다음과 같습니다.
초록색: 파일이 새로 생성된 경우
노란색: 기존의 파일을 수정한 경우
빨간색: 파일이 삭제된 경우
When you click on a commit to review the changes, you will see the following screen. The colors of the file names have the following meanings:
Green: The file is newly created.
Yellow: The existing file has been modified.
Red: The file has been deleted.
변경사항을 더 자세히 확인하고 싶은 경우 Commit을 클릭하면 다음과 같은 화면을 확인할 수 있습니다.
왼쪽은 변경 전의 내용이고, 오른쪽은 변경 후의 내용입니다.
예를 들어, 'revised file.txt'를 클릭하면 다음과 같이 'Also, I like dogs'라는 문장이 추가되었음을 알아낼 수 있습니다.
If you want to examine the changes in more detail, you can click on a commit, and you will see the following screen. The left side shows the content before the changes, and the right side shows the content after the changes.
For example, if you click on 'revised file.txt', you will see that the sentence 'Also, I like dogs' has been added, indicating the specific change made.
옛날 버전으로 돌아가기(To reset to an old version)
Commit들 간의 이동은 예민하고 복잡하므로, 옛날 버전으로 돌아가기 전에는 오른쪽의 화면처럼 Source control에서 변경 사항이 없는 상태에서 진행하는 것을 추천합니다.
만약 코드를 공유하고 있는 경우 'reset'이 아니라 'revert'를 추천합니다. 또한 'branch'를 추천합니다. 하지만 본 강의에서는 다루지 않습니다.
Moving between commits can be sensitive and complex. Therefore, before reverting to an old version, it is recommended to proceed from a clean state in Source Control, as shown on the right-hand side of the screen, with no pending changes.
If you are sharing your code with others, it is recommended to use 'revert' instead of 'reset'. Alternatively, using 'branch' is also recommended. However, we won't cover these topics in this tutorial.
1. 돌아가고 싶은 버전의 commit을 오른쪽 클릭하고, 'Reset current branch to this commit'을 클릭하세요.
2. 그러면 오른쪽 화면을 확인할 수 있습니다. 세 가지 옵션 중에 하나를 선택할 수 있고, 각 옵션의 설명은 다음과 같습니다.
Soft: 변경 이력은 모두 삭제하지만 선택한 과거의 Commit과 현재의 변경 사항을 모두 받아들입니다.
Mixed: 변경 이력은 모두 삭제하지만 변경 내용은 남기고 선택한 과거의 Commit을 받아들입니다.
Hard: 변경 사항을 모두 삭제하고 선택한 과거의 Commit만 받아들입니다.
1. Right-click on the commit of the version you want to revert to, and click on "Reset current branch to this commit."
2. You will then see the right-hand side screen. You can choose one of the three options, and here are the explanations for each option:
Soft: All commit history will be removed, but both the selected past commit and the current changes will be kept.
Mixed: All commit history will be removed, but the changes will be kept, accepting the selected past commit.
Hard: All changes will be discarded, and only the selected past commit will be accepted.
3. 선택한 옵션에 따라서 최우선적으로 Push를 성공시킨 후에 작업을 이어나가는 것을 추천합니다.
Version Control은 과정이 복잡하기 때문에 처음에는 신중히 Hard 옵션 만을 사용하는 것을 추천합니다.
보다 자세한 내용은 아래 링크의 자료들을 참고하세요.
3. It is recommended to prioritize successful pushes based on the chosen option before continuing with your work.
Since Version Control can be complex, it is advisable to start with cautious use of the "Hard" option. For more detailed information, please refer to the resources available at the links below.