GIT distributed Version Control System
Git is a free, open source distributed version control system designed to handle any project, small or large, with agility and efficiency.
Irrelevant: Apple’s Mac OS is derived from Unix, and Linux is a Unix system.
And Git is the father of Linux (Linus Torvalds) in order to maintain Linux, and invented the version control system –Git!
Common code management sites:
- foreign
-
- 1.GitHub
GitHub: github.com/
-
- 2.Gitlab: Support unlimited public and private projects.
Gitlab address: about.gitlab.com/
-
- 3.Bitbucket: Allows teams of up to five developers to create unlimited private code repositories for free.
Bitbucket address: bitbucket.org/
- Domestic:
-
- 1. Open Source Chinese code hosting: one account can create up to 1000 projects, including public projects and private projects.
Host address: git.oschina.net/
-
- 2.coding.net(code market) : one account can create a maximum of 1000 projects, also supports the creation of tasks.
Coding.net is at coding.net/home.html
-
- 3.CSDN code hosting
CSDN code hosting address: code.csdn.net/
Git operation:
Create a project
The CODE management site I use is —– CODE MART: mart.coding.net
Enter the official website, after creating an account, select “Coding.net” under your profile picture.After entering the code management page, you are ready to create the project!
Below is the creation of the project fill in!After the project is created, it will be displayedprojectthedynamic Click the code option to jump toCode managementPage.
⭐️ Select HTTPS or SSH for accessing the warehouse.
To configure the SSH public key: coding.net/help/doc/gi…
Use “SourceTree” to manage the project code and warehouse.
Enter your project’s URL to get your project’s Git repository from the web.
If you do not select the target path of the repository, the default path is used by the user.
After getting project repository: added “git_repository” repository. You can view and manage the warehouse
- Right-click and choose In Finder to view the project repository
View the project Repository in Finder:
- Right click and say open
The warehouse can be managed and operated
In the repository, introduce the Xcode project
inRemote warehouseandLocal repositoryOnce created, you can open Xcode in theLocal repositoryThe inside of theThe pathcreateengineeringthe
Here is the code for the project :(write something casually)
For their own projects (code)writeWhen finished, in “SourceTree”To view warehousethestateThe ~ ~ ~
Click “Unstored Files”,mergeOwn code and previous code. Then fill in your own on the projectThe editor information(that is, work on the project) to submit a local version.⚠️ : Select to add “not temporarily stored files”, to remove the development of common”.DS_Store“fileAnd so on. Of course you can do itIgnore files(“.gitignore“File).
After you submit the project information and build, look at the repositoryLocal (version) information:After clicking push:Push to remote repository succeeded:
On the project management website, viewProject versionAnd its latestinformation : Click on the”Submit the history“To seeprojectWarehouse detailsChange history:
Click “viewController. m” to enter “ViewController”To viewPrevious modification ormodified:
Edit (remove extra lines) and save: The latest information of the project after successful submission:
Any changes made to the remote repository of the project, the next time you use the project: grab the project first (to prevent the previous partner to modify and merge the code in multiplayer development. Cause the version is not up to date) to ensure that the current project version is up to date. That is, when we are in multiplayer development, the next day it is best to pull down the latest version of the Internet! Unless you are the last one to go ~~😂😂😂😂😂
Grab (The latest) Remote project repository:After capturing the latest project version information, view the modification information of the project: Click “pull” and then click “Ok” to get possessionThe latestInformation items:
In Finder, view and open the project
After opening the project:
Multi-person project management
Get a copy of the previous project locally (select another path and empty folder)
Tips: Choose your own pathMust be 为An empty folder 或 A new folderOtherwise, the following prompt will appear:
Latest projects:
Can start two peopleAt the same time the developmentA project! Assuming thataboveFor developersA.belowFor developersB. Open the location (right click -> Show in Finder) and open the project file!
developersA, developers,BModify the project separately:
Developer A’s version information:
For developer B, pull the latest version of the project again! Merge and continue development! Of course, you can also merge after your own code task is complete!
😂😂😂😂 doctor 😂😂 If the merge is performed, a message will be displayedconflict! becausetwoaversionThere are different places!
Conflict between merge and Developer A:
Merge conflicts and submit the “conflict resolved” version:
Push to server:
Because the last time it was a developerBSubmitted version! So next development: for developersAThat must begrab,pullThe latest version!
takenThe latest version~ ~
But developer B wasn’t careful about merging the conflicts (that’s me ~~😂).
developersAHelp,Modify theError code:After modification, developersAagainsubmitLocal version,pushTo the server!
So developersB, and need to regrab,pullA new version (so-called: Self-inflicted, not alive ~😂😂😂)
After pulling, the version is the same as developer A:So developersAWith the developerBThe project ofversionitconsistent!
⭐️Tip: If each version has different changes to the same code, there is bound to be conflict.
terminalThe command lineThe use of:
Direct operation of git repository, more convenient and simple! Although not sourcetree so intuitive, image, but for the two of the development, is to do enough!
Git commands are listed below:
Git Git
Multi-player development and command line operation:
usage
Conflict:
<<<<<<< HEAD
=======
>>>>>>> a3a4813c36a88970f43873546331581a490ea114
Copy the code
General simple operation of terminal:
Git status git status check git statusCopy the code
General operation steps:
Git add --all Or: git add. git commit -m"7.0" // Commit the version information (⭐️ local ⭐️) git pull // pull the latest version of the network // resolve the conflict Git push // push the merged version to the webCopy the code
Or resolve the conflict first and commit the local version later.
Git version control: Git conflict resolution error summary Git multi-person collaboration code merge process
Git reset --hard 81bef82 // reset the old versionCopy the code
Long time writing article ~ this article span several months, also drunk… 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂 😂
git pull –rebase
After git merge B is executed on the D branch, D is merged onto A. Git rebase B on the D branch is the same as the merge, but the “D-e” branch is gone and the two branches are merged.
(2017.06.10)
goyohol’s essay