Git is a distributed version management tool, and now we use it for versioning on the front side. I've seen some information before, but I didn't use it to manage project code. Now, it's been a while, so write something for reference only.
# # #快速上手
Several git commands that you work with often:
1. Git Clone repository Address
Cloning a remote repository to a local
2. Git Checkout branch Name
Switch the current work branch to a daily branch and start writing code
3. Git Add.
Add files to staging area for workspace modified files
4. Git commit-m ' comments for this submission '
Commit staged content to the local repository
5. Git push Origin branch name
Submits the contents of the current work branch of the local repository to the corresponding branch of the remote repository
6. Git tag label signature
The current state of the repository is labeled with this command before publishing to identify the current state of the repository as a stable, published version
git tag publish/1.0.0 git push Origin publish/1.0.0
With these commands, you can basically write code, and you can use the command in the process:
git < commands >--help to see a detailed help document for a command. such as: Git commit--help, will display the help information of the commit command, after reading, press Q to return to the command line.
# # #三种文件状态
Executing commands on the current work branch: Git status
You can view the status of files under the local current work branch. Git has the following three file statuses:
1. untracked files: Represents a new addition in the workspace that has not yet been added to staging area using the git add command.
2. Changes to be committed: Indicates that the file has been added to staging area using the git add command, but the contents of staging area are not submitted to the local repository using the git commmit command
3. Changes not staged for commit: Represents a file that has changed in the workspace after committing to the local repository using git commit.
Using the command: Git checkout--filepath
Changes to the current workspace are lost when the file is moved from staging area to the current work area.
Using the command: Git checkout commit--filepath
Overwrites staging area and workspaces with the most recently committed content in the current local repository.
# # #常见问题
Using the process to find out that Git has some basic and prior access to the version management tools still have to write less. Here are some of the questions I use in the process:
1. What does the origin of git mean?
Origin is the alias of the remote repository that we cloned from Git clone. You can use the command:
Git remote-v View the warehouse address that Origin points to.
2. What does Git's head mean?
Git head It is a pointer to the current working branch.
3. How do I get git to ignore certain special files/files?
To create a new. gitignore file under the root directory of the current working directory, Git ignores the files/folders contained in this file. The general Gitinore will contain the following content:
node_modules/
. idea/
. Ds_store
Node_modules/: typically contains some NODEJS modules that are dependent on grunt packaging tools
. Ds_store: A hidden file that is a custom property of the Mac OS Save folder, such as the file's icon location or background color, equivalent to the Desktop.ini of Windows.
. Idea: Folders are typically used to store the editor's configuration file
4. How do I delete a local tag?
Git tag-d tag names, such as Git tag-d pulish/1.0.1
# # #最后:
Day up, happy work!
Git uses journaling