Git Tutorial
7/17/25About 249 wordsLess than 1 minute
Warning
This tutorial is only for people who has the code basis.
For any consequence, the author is not responsible.
Warning
This page haven't been completed.
This article provides part of using tutorial and command explaination for Git.
Config
- View the global configuration
git config -l --global
- Modify the configuration
git config [option] <config> <custom>
- Use the SSH key
git config --global user.signingkey ~/.ssh/id_ed25519.pub
Start a repository
- Clone an existing repository
git clone <remote-repo>
- Create a new repository
- Initialize the git project
git init
- Keep track of project files
git add ./*
- Commit the project files
git commit * -m 'Initialization'
- Create a remote repository on Github/other website and copy the domain
- Record the domain of the remote repository
git remote add <remote-repo> <name>
- Push files to the remote repository
git push
- Initialize the git project
Remote repository management
- Record new remote repository
git remote add <remote-repo> <repo-name>
- View all remote repository
git remote show
Branch Management
- Create and switch to the branch
git checkout -b <new-branch>
- Switch to branch
git switch <branch>
Work Flow
- Pull newest update
git pull
- View current branch
git branch -v
- (Optional) Create and switch to the branch
git checkout -b <new-branch>
- Work
- Add the files to staging area
git add .
- Commit the files
git commit -m "message"
- Push the local branch to remote repository
git push <name> <branch>
- Pull Request