uploading a local project to GitHub using the terminal commandTurn from 52020305for iOS developers, the use of GitHub is a skill that must be mastered, and there are several ways to upload items from the ground to GitHub, 1 development tools Xcode configuration Git, by Xcode-->source control--> COMMIT;2 uploads the code using the GitHub client, and 3 uploads to GitHub using the terminal command line. Where my github address has a configuration manual that I've made according to the actual project Https://github.com/FISHBALL1/Xcode-git, now to introduce a third command line upload to GitHub, is one of my favorite ways.
First step: Build a local git repository
CD to your local project root directory, execute the git command
Git init
Step Two: Add all the files from the local project workspace to the staging area
git Add.
If you want to add the specified file in the project, then change the. To specify a filename .
Step three: Submit the file of the staging area to the local warehouse
Git commit-m ""
Write a comment statement inside the colon
Fourth step: Create your own repository on GitHub and create
Click on the Create repository below to enter the interface below and then copy the HTTPS address in the address bar.
Fifth step: Associating a local warehouse to GitHub
Git remote add Origin https://github.com/FISHBALL1/DropList
The URL at the back is the https address I copied at step fourth.
In this step, if an error occurs: Fatal:remote origin already exists
First enter the GIT remote RM origin
Then enter git remote add Origin https://github.com/FISHBALL1/DropList will not error.
Sixth step: The final step, upload the code from the local repository to the GitHub remote repository
Git push-u Origin Master
After execution, if the upload succeeds without errors, it is necessary to note that the master is the default branch of GitHub, if your local current branch is not master, use the git checkout Master command to switch to the Master branch, if you want to use local The previous branch uploads the code, then the sixth step of the command
The master in the switch to your current branch name.
Upload Successful interface
Finally, share some of the common GitHub commands:
Switch branches: git checkout name
Undo modification: Git checkout--file
Delete file: git rm file
View status: Git status
Add a record: git add file or git Add.
Add Description: Git commit-m "Miao shu nei rong"
Synchronizing data: Git pull
Submit data: Git push origin name
Branching operations
View branches: Git branch
Create a branch: Git branch name
Switch branches: git checkout name
Create + Switch branch: git checkout-b name
Merge a branch to the current branch: git merge name
Delete branch: git branch-d name
Delete Remote branch: git push origin:name
Uploading a local project to GitHub using the terminal command