Summary
Git is a source code version control system that allows multiple people to work on a project at the same time by tracking the project’s change history.
Basic Concepts of Git
- repository
A repository in Git is a place where the changelog of a project is stored. There are two types of repositories: local and remote. A local repository is a repository that developers keep on their own computers, while a remote repository is used to share projects.
- commit
A commit in Git refers to applying changes to the repository. Changes can be expressed in various forms, such as adding a new file, changing an existing file, or deleting a file. A commit also includes a message describing the change.
- branch
A branch in Git is the ability to branch a repository’s changelog. By creating a new branch, developers can isolate changes in a project and work on separate development tasks simultaneously. Branches are primarily useful when developers are implementing multiple features simultaneously.
- merge
Merging in Git refers to merging changes from different branches into a single branch. Merging allows developers to integrate multiple development efforts into a single project.
- pull request
A pull request in Git is a feature that allows developers to send merge requests from their own branch. Pull requests allow other developers to review and approve changes.
Getting Started with Git
To get started with Git, the following preparations are required
- Installing Git
First, you need to install Git. Follow the instructions for installing Git for each operating system from the official website.
- Setting up Git
To use Git, several settings are required. These settings include name and email address, newline code settings, etc. The git config command can be used to change these settings.
- Create a Git repository
A Git repository is a place to store the history of changes to files; to create a Git repository, the current directory must be initialized to a Git repository using the git init command. You can also clone an existing repository.
- Learn Git commands
Git has many commands. You need to learn the basic commands and how to use Git. Please refer to the reference books mentioned below, the official Git documentation, and online tutorials.
Configure Git Preferences
There are two Git preferences: global and local.
- Global Settings
The global settings are settings that apply to all Git repositories you use. You can change the global settings with the following commands
git config --global <設定名> <設定値>
For example, you can set up a name and email address as follows
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"
- Local Settings
Local settings are settings that apply to a specific Git repository. You can change the local settings with the following commands.
git config <設定名> <設定値>
For example, a repository-specific editor can be set up as follows
git config core.editor "vim"
In addition, Git has many settings. Below are some examples of commonly used settings.
- user.name: Sets the name to be used for the commit.
- user.email: Sets the email address to use for commits.
- core.editor: Sets the editor for editing commit messages.
- core.autocrlf: Configure autoconversion of line endings.
- color.ui: Set whether the output of Git command is colored or not in the terminal.
Basic Git Commands
The basic Git commands are as follows.
- git init: initialize the current directory to a Git repository.
- git clone: creates a copy of the repository.
- git add: Adds the modified files to the staging area.
- git commit: Commits changes to the repository.
- git push: Pushes changes from the local repository to the remote repository.
- git pull: pull changes from the remote repository and merge them into the local repository.
- git status: displays files that have been changed.
- git log: displays the commit history.
- git branch: Create a branch.
- git checkout: Change a branch.
Mastering these basic commands will help you use Git more effectively.
Reference books for Git
A good reference book on Git is “GitHub Textbook for Web Producers.
This book is a guide to understanding how to use GitHub in web production, using images of actual workflows. By simulating specific scenes while reading this book, you can smoothly grasp the flow of how to use GitHub. The contents are as follows.
GitHub Textbook for Web Producers
Introduction
Commonly used terms in GitHub
Chapter 1: Hello Git, Nice to meet you GitHub
1-1 From a Web Production Site
1-2 Web Production in the Social Coding Era
Chapter 2: Basic GitHub Features You Need to Master
2-1 It's fun to work together! Features of GitHub
2-2 The structure of the GitHub screen
Chapter 3! From Repository Creation to Clone
3-1 Installing Git
3-2 Getting a GitHub Account
3-3 User and Organization Accounts
3-4 Creating a Repository
3-5 Managing Members
3-6 Copy (clone) Git locally
3-7 Version control with Git
3-8 Reflect changes on GitHub
Chapter 4: Practice! From Presenting Multiple Designs to Adoption
4-1 Proposing a Design Using an Issue
4-2 Share Design Consultation and Revision on Issue
Chapter 5! From Sharing to Merging Using Pull Requests
5-1 What is a Pull Request?
5-2 Collaborating with Pull Requests
5-3 Dealing with common problems when sending Pull Requests
Chapter 6 Documentation and Progress Management for Comfortable Collaboration
6-1 Issue to solve issues while interacting with team members
6-2 GitHub Markdown
6-3 wiki
Chapter 7! Useful GitHub Techniques
7-1 LGTM: GitHub Style Communication
7-2 GitHub Techniques GitHub Techniques
7-3 Aim for advanced users! Behind-the-scenes GitHub Techniques
Next is “Git Textbook for Engineers: Practical Use! Version Control and Team Development Methodology“.
This book is designed to help you learn to use Git in practice, explaining not only the basics of how to use it, but also how to understand how distributed version control systems work, as well as practical team development techniques such as branch design and operation and continuous integration. The contents of the book are as follows
Git Textbook for Engineers: Practical and useful! Version Control and Team Development Methodology Recruit Technology Co.
CHAPTER-01: Basics of Git and Version Control
01-01 Learn the Basics of Version Control
01-02 Learning the Basic Concepts of Git
01-03 Installing Git
01-04 Learn Basic Git Commands
01-05 Learn More Git Commands
01-06 Configure Git settings
CHAPTER-02: Efficient Design and Operation of Team Development
02-01 Understanding Team Development
02-02 Practice Team Development
02-03 Designing Team Version Control Operation
02-04 Designing Commit Operation Rules
02-05 Practice Code Review
CHAPTER-03: Usage and Release Techniques in Practice
03-01 Understanding Optimal Branching and Code Operation for Team Development
03-02 Using Git to the Fullest
03-03 Continuous Delivery
For more advanced users, there is “Git Textbook for Engineers [Advanced Edition] Understanding the Internal Workings of Git.
After learning Git, designing team operations and development flow, and actually starting operations, you will encounter more and more problems that you did not expect. In most cases, the problems that team members come to me for help with are usually the result of a situation that requires a little ingenuity or a twist to solve. At that point, we first figure out what’s going on, and based on that information, we look up low-level Git commands to solve the problem, or we struggle to get the history back to base by making full use of branches.
When you understand the current state and figure out what needs to be done, you need to know the internal structure of Git’s version control, how the commands you normally use casually work internally, and what the data structure is like. By understanding the “why” of what is working, you will be able to respond to any problems much faster. In addition, branch management and daily Git operations will feel much easier if you can picture the internal workings in your mind. The following is a description of the process.
Git Textbook for Engineers [Advanced] Understanding the Internal Workings of Git Section01 Understanding git's Version Control Mechanisms (Beginner) Section02 Understanding Git Version Control - Intermediate Section03 Understanding Git Version Control - Advanced
コメント