This article is intended as a basic manual for iOS developers that are using git source control, but need more than built in options in xCode.
For that we will need to open Terminal application located in Applications/Utilities. Use 'ls' command to see content of the current folder, and 'cd FOLDER_NAME' to open specific subfolder. Command 'cd ..' will open parent folder.
If you want to simply clone repository from remote repository then run this command in your terminal:
git clone HTTPS_ORIGINAL_REMOTE_REPOSITORY.gitThis will clone project to the current folder.
Second scenario is that you want to add existing project to remote repository. Go to the folder that contains your .xcodeproj project file.
To check current status:
git statusWhen your code is already tracked by Git, and you want to change the repository, you have two options.
1. Remove git tracking and start fresh:
rm -rf .git2. Set new repository as your origin to push to.
git remote set-url origin HTTPS_NEW_REMOTE_REPOSITORY.gitTo start git tracking, initialize empty git
git initNext step is to add original remote repository, which you acquire at your git hosting service, e.g. Bitbucket
git remote add origin HTTPS_ORIGINAL_REMOTE_REPOSITORY.gitAdd all files from your project directory
git add --allCommit
git commit -m "Initial Commit"Push
git push origin masterYour project is now pushed to remote repository.
No comments:
Post a Comment