In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use the GIT command in linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Set user information
This should be the * * step after installing git. We will add user information (username and mailbox), so when we submit the code, we generate submission information with user information, which makes it easier to track the submission process. To add user information, the command is git config:
$git config-global user.name "Daniel" $git config-global user.email "dan.mike@xyz.com"
After adding the user information, we will check that the information has been successfully updated by running the following command.
$git config-list
We should be able to see the output user information.
GIT command to create a new warehouse
To build a new warehouse, run the following command:
$git init finds a warehouse
To find a warehouse, the command is as follows:
$git grep "repository" connects to the remote warehouse
To connect to the remote warehouse, run the following command:
$git remote add origin remote_server
Then check all configured remote servers and run the following command:
$git remote-v Clone a warehouse
To clone a repository from the local server, run the following code:
$git clone repository_path
If we want to clone a warehouse on a remote server, the command to clone the warehouse is:
$git clone repository_path lists branches in the warehouse
To check the list of all available and currently working branches, execute:
$git branch create a new branch
To create and use a new branch, the command is:
$git checkout-b 'branchname' deletes a branch
To delete a branch, execute:
$git branch-d 'branchname'
To delete a branch of the remote warehouse, execute:
$git push origin:'branchname' switches to another branch
Switch from the current branch to another branch, using the
$git checkout 'branchname' add File
Add files to the warehouse, execute:
$git add filename file status
Check the status of the files (those that will be submitted or added) and execute:
$git status to submit changes
After we add a file or make changes to a file, we commit the code by running the following command:
$git commit-a
To commit changes to head but not to remote repositories, the command is:
$git commit-m "message" push changes
To push changes made to the master branch of the warehouse, run:
$git push origin master pushes branches to the warehouse
Push changes made to a single branch to the remote warehouse, run:
$git push origin 'branchname'
Push all branches to the remote warehouse, run:
$git push-all origin merges two branches
Merge another branch into the current active branch, using the command:
$git merge 'branchname' merges from the remote server to the local server
Download / pull changes from the remote server to the working directory of the local server, and run:
$git pull check for merge conflicts
To view merge conflicts on library files, run:
$git diff-base 'filename'
To view all conflicts, run:
$git diff
If we want to preview all the changes before merging, run:
$git diff 'source-branch'' target-branch' create tag
To create a tag to mark any important change, run:
$git tag 'tag number'' commit id'
We can find commit id by running the following command:
$git log push mark
Push all created tags to the remote server, run:
$git push-tags origin reply to changes made
If we want to replace the changes to the current working tree with a single change in head, run:
$git checkout-'filename'
We can also get the history of * * from the remote server and point it to the master branch of the local repository instead of discarding all changes made locally. To do this, run:
The above $git fetch origin$ git reset-hard master is all the contents of this article entitled "how to use GIT commands in linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, 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.