In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the use of git what the relevant knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe you will have some gains after reading this article on the use of git, let's take a look at it.
Installation
Download the git OSX version
Download the git Windows version
Download the git Linux version
Create a new warehouse
Create a new folder, open it, and execute
Git init
To create a new git repository.
Check out the warehouse
Execute the following command to create a cloned version of the local repository:
Git clone / path/to/repository
If it is a warehouse on a remote server, your command will look like this:
Git clone username@host:/path/to/repository workflow
Your local warehouse consists of three "trees" maintained by git. The first is your working directory, which holds the actual files; the second is the Index, which is like a cache area that temporarily stores your changes; and finally, HEAD, which points to the result of your last submission.
Add and submit
You can propose changes (add them to the staging area) with the following command:
Git add git add *
This is the first step in the basic git workflow; use the following command to actually commit the changes:
Git commit-m "Code submission Information"
Now, your changes have been submitted to HEAD, but not yet to your remote repository.
Push Chan
Your changes are now in the HEAD of the local warehouse. Execute the following command to commit these changes to the remote warehouse:
Git push origin master
You can replace master with any branch you want to push.
If you have not cloned an existing warehouse and want to connect your warehouse to a remote server, you can add it with the following command:
Git remote add origin
So you can push your changes to the added server.
Branch
Branches are used to insulate feature development. When you create a warehouse, master is the "default" branch. Develop on other branches and merge them into the main branch when you are done.
Create a branch called "feature_x" and switch over:
Git checkout-b feature_x
Switch back to the main branch:
Git checkout master
Then delete the new branch:
Git branch-d feature_x
Unless you push the branch to the remote warehouse, the branch is invisible to others:
Update and merge of git push origin
To update your local warehouse to the latest changes, execute:
Git pull
To fetch and merge the remote changes in your working directory. To merge other branches into your current branch (for example, master), execute:
Git merge
In both cases, git tries to merge changes automatically. Unfortunately, this may not always be successful, and conflicts may occur (conflicts). At this point, you need to modify these files to manually merge these conflicts (conflicts). After the changes, you need to execute the following command to mark them as successful:
Git add
Before merging changes, you can preview the differences using the following command:
Git diff tag
It is recommended to create tags for software releases. This concept has existed for a long time, as well as in SVN. You can create a tag called 1.0.0 by executing the following command:
Git tag 1.0.0 1b2e1d63ff
1b2e1d63ff is the first 10 characters of the submit ID that you want to mark. You can get the submission ID using the following command:
Git log
You can also use fewer submission ID top bits, as long as its pointing is unique.
Log
If you want to know the history of the local warehouse, the easiest command is to use:
Git log
You can add some parameters to modify his output to get the results you want. Just look at one person's submission record:
Git log-author=bob
A compressed commit record takes up only one row of output:
Git log-pretty=oneline
Or you want to show all the branches through the tree structure of ASCII art, each marked with its name and label:
Git log-graph-oneline-decorate-all
See which files have changed:
Git log-name-status
These are just a few of the parameters you can use. For more information, refer to:
Git log-- help replaces local changes
If you make a mistake (of course, this had better never happen), you can replace the local changes with the following command:
Git checkout--
This command replaces the files in your working directory with the latest content in HEAD. Changes that have been added to the staging area and new files are not affected.
If you want to discard all your local changes and submissions, you can get the latest version history on the server and point your local owner branch to it:
Git fetch origingit reset-practical Tips for hard origin/master
Built-in graphical git:
Gitk
Color git output:
Git config color.ui true
When the history is displayed, only one line is displayed for each submitted information:
Git config format.pretty oneline
Interactively add files to the staging area:
This is the end of git add-I's article on "how to use git". Thank you for reading! I believe you all have a certain understanding of the knowledge of "what is the use of git". If you want to learn more, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.