$ git help config
3. Build a local database
There are two methods: command and Gui
A. Command method:
Open git Bash:
CD to the folder where you want to create a version Library:
1) run the following command:
--------------------------------
$ Git init
-------------------------------
2) Create the file to be added:
If several files in the current directory want to be included in version control, you must first run the GIT add command to tell git to start tracking these files and then submit them:
--------------------------------------------------------------
$ Git add *. c
$ Git add readme
$ Git commit-m'initial project version'
----------------------------------------------------------------
Note:
The GIT add command pulls the file into version control. *. C Indicates adding all c files.
Git commit-m'initial project version' indicates the comments during submission.
Now you have a git repository that actually maintains several files.
3) clone from existing warehouse:
---------------------------------------------------
$ Git clone git: // github.com/schacon/grit.git
-----------------------------------------------------------
Or
-------------------------------------------------------
$ Git clone git: // github.com/schacon/grit.git mygrit
----------------------------------------------------------------
Mygrit name the cloned database name for you
Clone from the local repository: replace git: // github.com/schacon/grit.git with the GIT repository path.
B. Gui
1) local library folder in the local file: Right click: Select git init here ----> or use git create repository here
A folder named. Git is displayed under the local library folder, which is a hidden folder.
2) Create the file to be added and right-click it: git add all files now
Then: git commit --> "master" can see the following interface. Enter the commit message and click OK.
Right-click git history to view the previous version.
Right-click to create a branch:
Then
For example, mybranch
The successfully created branch is displayed.
2) switch to the working directory clone library and select git clone
Right-click and select:
Select dir as the local database, and Web as the remote database
Select the corresponding folder or web and git address. You can see that there are files in the local database.
3) Right-click to modify any file:
Select git commit --> "master"
You can view the history through git history.
This is only because the tracking file is submitted locally and not submitted to the remote database.
As shown in the following figure: push to the repository
In this way, you can view the modified content in the GIT version library.
Note: This commit is submitted to the mybranch created in the branch you created. You can only right-click the repository and switch to git branch and switch to mybranch to see the modified result.
Note: git branch of the Repository cannot be under the Branch you want to submit during push. That is, when submitting a request to mybranch, git branch must switch to the master branch or another branch you have created. If mybranch is used, the push fails, because git considers mybranch To Be In checkout by default and cannot submit.
4) Merge the contents of mybranch into the master Branch
First, run the following command:
-----------------------------
$git diff mybranch
--------------------------
If the GIT diff command is executed and the modification to the test Branch (mybranch) is correct, you can use the GIT merge command to merge it into the master branch:
Run the following command:
-------------------------------------
Git merge mybranch
--------------------------------------
In the graphical interface, switch to the mybranch branch and right-click
If you select merge, the master branch can be merged.
Git Initial Attempt