1.5.1 Git Tutorial for Basic Operations of Local Repositories
Category Android Basic Tutorial
What is Git?
>
A distributed version control system, similar to SVN, but far more powerful than SVN. ①Git can conveniently manage versions locally, as if you have a version management server on your local machine. We can choose to push the local version to a unified version management server at an appropriate time. ②Each time Git extracts a complete image of the entire code repository, which is equivalent to backing up the entire code repository, so even if the version server has a problem, we can directly use the local repository to restore! Combined with local version management capabilities, if the remote version management server has a problem, we can still continue to write our own code, and when it recovers, we can submit our local version! Git was initially developed to better manage the Linux kernel, but now it has been widely used in various projects!
Installing Git
If your system is Linux, just open the shell and enter:
sudo apt-get install git
Of course, most systems are probably Windows, which requires us to download Git For Windows from the Internet. You can download it from the following website: https://git-for-windows.github.io/ Click Download to jump to Github and download the corresponding installation package!
After clicking, you will enter the page and can download the following file.
Or directly download the latest version 2.7.0: v2.7.0.windows.1 Then just follow the simple next steps.
Next, you can find Git Gui to start playing with Git, but if you switch to other platforms in the future, you will be unable to move without a graphical interface! So, if you are interested, let's play with the command line, and you can still play with Git normally after changing the system!
Mastering Git Command Line
Of course, Git is definitely more fun when paired with GitHub, but first, let's learn some local commands! After you install Git, you can right-click anywhere and click Git bash to open our Git command line! You can also click Git Init Here to create a code repository directly in the current directory, or click Git Gui to open the Gui graphical operation page!
1. Create a Code Repository
Step 1: First, let's configure our identity, so that Git knows who submitted the code when committing, the command is as follows:
git config --global user.name "coder-pig"
git config --global user.email "[email protected]"
After the configuration is completed, we can enter again, excluding the name, and we can see that we have successfully configured it.
Step 2: Find a place to create our code repository, and then I created a new project: TestForGit, come to the project directory, right-click, open our Git Bash, and enter the following command to complete the creation of the code repository! In addition, this code repository is actually used to save some information required for version management, and the code we submit locally will be submitted to the code repository, so we can choose to restore to a certain version, of course, if necessary, we can also push the code saved in the code repository to a remote repository! Such as GitHub!
git init
A simple code, the code repository is created! Continue to enter: ls - al to see a .git folder in the directory is him!
You can also open the project directory and see the .git folder; if you want to delete the code repository, just delete this folder!
2. Submit Local Code
After creating the code repository, let's talk about how to submit the code. We first use the add command to add all the content to be submitted, and then commit is the real submission operation! The command example is as follows, you can add one by one slowly, of course, you can also submit all at once, just git add . to complete!
Let's create a readme.txt file in the current project directory and try to write something, and then enter the following commands one by one:
git add readme.txt
git commit -m "Wrote a readme file"
Try entering the command.
Of course, if you can add multiple files and then commit at once, but if we change a lot of files, we can git add . to add them all at once, but some are not changed for hundreds of years or automatically generated, such as lib, gen, bin folders, etc., we can create a file named .gitignore in the root directory
2.5.4 AutoCompleteTextView (Auto-Complete Text Box) Basic Usage
2.5.8 Notification (Status Bar Notification) Detailed Explanation
3.6 Responding to System Setting Events (Configuration Class)
[4.2.1 Introduction to Service](android-tutorial-service-
8.3.4 Paint API - Xfermode and PorterDuff Detailed Explanation (I)
8.3.5 Paint API - Xfermode and PorterDuff Detailed Explanation (II)
8.3.6 Paint API - Xfermode and PorterDuff Detailed Explanation (III)
8.3.7 Paint API - Xfermode and PorterDuff Detailed Explanation (IV)
8.3.8 Paint API - Xfermode and PorterDuff Detailed Explanation (V)
8.3.14 Paint Several Enum/Constant Values and ShadowLayer Shadow Effects
8.3.17 Detailed Explanation of Canvas API (Part 2) - Collection of Clipping Methods
8.3.18 Detailed Explanation of Canvas API (Part 3) - Matrix and drawBitmapMesh
8.4.3 Android Animation Collection - Property Animation - First Glimpse
8.4.4 Android Animation Collection - Property Animation - Revisited
[10.2 SmsManager (SMS Manager)](android-