Git Version controls tutorial for Xcode projects - ios

How to manage my Own project on server using Git version control.
Is there any tutorial for creating Server and adding project using Git commands.

I don't completely understand what you mean by creating server.
But if you mean creating a repository, then what you can do is go to one of the following websites and create a free account based on your need:
Github: https://github.com
Bitbucket: https://bitbucket.org
Now the above two have following features:
Github support unlimited free public respositories, and paid private repositories.
Bitbucket supports unlimited free private repositories.
You can start with creating a free account. Then go to your project repository root folder and execute the following commands in the same order:
for instance using bitbucket: -
git init
git remote add origin git#bitbucket.org:username/abc.git
echo "Anil Gupta" >> contributors.txt
git add contributors.txt
git commit -m "Initial commit with contributors"
git push -u origin master
Thereon you can follow this tutorial:
https://www.tutorialspoint.com/git/git_tutorial.pdf
Cheers!

Related

Azure DevOps - Moving TVCS Repo from one tenant to another - 2021

Before posting this question I have looked through all the similar ones. Finding no workable solution I am asking for help.
Thanks in advance!
I am trying to copy the repository from one tenant to another one using the following approach:
(done) Download the tool: Download Microsoft Git-TF for Visual Studio Team Foundation Server and Visual Studio Online from Official Microsoft Download Center
(done) Download Git-TF and Git-TFS (done with using git-tfs)
Clone an existing TFVC repo to my local machine as a Git repo using the Git-Tf tool: git-tf clone https://dev.azure.com/myorg/ "$/mysourceteamproject/mysourcebranch" --deep git-tf is no longer supported so I used git-tfs here. git-tfs clone https://dev.azure.com/myorg/ "$/mysourceteamproject/mysourcebranch" --deep
(done) Cd into the directory that the code was cloned into and push the local Git repo to any empty remote Git repo (this will be used as a temporary repo during the migration) git remote add origin https://user#dev.azure.com/myorg/anyteamproject/_git/tempgitrepo git push -u origin –all
(done with using git-tfs) Cloned the temporary Git repo to my local machine git-tfs clone https://user#dev.azure.com/myorg/anyteamproject/_git/tempgitrepo
(done ) Created an empty new folder “migrated” in the existing target TFVC repo (done with git-ft but from this step I am not sure it is a correct approach now) Cd into the directory that the code was cloned into, and run the configure command: git-tf configure https://dev.azure.com/myorg/ "$/mytargetteamproject/migrated" (here git-tf does not due to Basic Authentication issue as it is no longer supported. Using gif-tfs led to bootstrapping to the tenant we would like to copy from - to original )
Run the pull command to merge two repos does not work - git-tf pull leads to bootstrapping to the wrong tenant - git-tfs pull the steps below simply cannot be executed as the step 8 cannot be completed properly.
Run a basic git commit command git commit -a -m "merge commit"
Checkin to the TFVC repo git-tf checkin –deep --metadata
The question is - is there a way to move TVCS repo from one tenant to another TVCS tenant repo?
Finally, I managed - of cause not only me - to do migration.
Unfortunately, git-tfs could not be used as it works not as git-tf.
The main issue was Authorization step with using git-tf.
Using token name and token as user name and password accordingly helped a lot.
All the steps done can be seen below:
Install GIT, GIT-TF, Java
To clone source repository to local GIT
git-tf clone https://azerov:[source token]#dev.azure.com/OrganizationName "$/D365FOps_Learn02/Trunk" --deep
username: TestPatMigration (the name of the token)
password: [source token]
Create any remote GIT repository to push local cloned repo there
cd into cloned repo c:\users[curuser]\Trunk
git remote add origin
https://azerov:[git temporary target token]#dev.azure.com/OrganizationNameTarget/GitTemp02/_git/GitTemp02**
To push local cloned repo into temporary GIT repo
git push -u origin –-all
To clone temporary git repo to local machine
git clone https://azerov:[git temporary target token]#dev.azure.com/OrganizationNameTarget/GitTemp02/_git/GitTemp02
To configure the target TFVS Project to push local temporary GIT repo there
cd into c:\users\GitTemp2
git-tf configure https://azerov:[git temporary target token]#dev.azure.com/OrganizationNameTarget/ “$/D365FOps_learn02/Trunk”
git-tf pull
Username: PATMigration (the name of the target source token)
password: [git temporary target token]
git commit -a -m "merge commit"
git-tf checkin –-deep –-metadata

How to migrate application source code from SVN to AWS CodeCommit

I want to migrate iOS application source code from SVN to AWS CodeCommit.
I checked everywhere but haven't got proper information. Somewhere I got know that first need to migrate source code from SVN to GIT and then can able to migrate it on AWS Code Commit from GIT.
Need to confirm that is it correct information.
I just did it for my project via these steps.
Migrate project from svn to git using svn2git
Create an online project in a git repository for temporarily storing the project before moving to CodeCommit. I used gitlab.
Push the git project to the online repo
git remote add origin git#gitlab.com:corridor/project_name.git
git push origin --mirror
Follow https://docs.aws.amazon.com/codecommit/latest/userguide/how-to-migrate-repository-existing.html to migrate git project from gitlab to CodeCommit
That is correct. AWS CodeCommit stores private Git repositories, and does not support SVN natively. Once you have a Git repository, you should be able to push to CodeCommit.
Also, maybe this doc can help you with the migration: https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git

how to add existing non-git project to bitbucket

I created a project using angular cli. Project is in directory dw-ng2-app and it has several files generated by angular cli. I want to create a Bitbucket repository for this. My confusion is, when I create a repository in Bitbucket, it gives me 3 options
I create a README and .gitignore file. I cannot use this option as
then when I try to sync the local project with repository, I get
error that there is no common history
I selected option of starting
from scratch. The web page listed the commands I should run to clone
and upload, eg git clone git#bitbucket.org:username/angularcli.git
but this creates a new directory on my local machine named
angularcli which has .git directory. I am not sure if I can use this
option as my project is in different directory and moving it to
angularcli directory might affect it (not sure)
3rd option is to
mention that I have an existing project. Then I am prompted to use
the command git remote add origin
ssh://git#bitbucket.org/username/angularcli.git but that doesn't
work as my current project directory is not a git repository
How can I move the angular cli project to bitbucket? Should I have created the repository first and then created angularcli project in the generated directory?
There are a couple of ways to do this, but the simplest may be to simply make your current project directory, a git repository.
Go to your project directory
cd dw-ng2-app
Initialize git repository
git init .
Add your current project to be tracked
git add --all
Make your initial commit
git commit -m "Initial commit for Angular project"
At that point, you can use the third, "existing project" option within BitBucket.
After you've created a new repo there, you can see its URL and use that to track your new repository with your local one
git remote add origin https://username#your.bitbucket.domain:7999/yourproject/repo.git
git push -u origin master
[Here's a complete writeup from BitBucket if you need.][1]
note - I used git add . originally in my example, and BitBucket recommends git add --all. Either of these will work fine in your case.
[1]: https://confluence.atlassian.com/bitbucketserver/importing-code-from-an-existing-project-776640909.html
If you've created project using angulat-cli then it automatically created project with git initialisation. It also commits initial changes locally.
So you just have to add remote origin and push the content.
-If repository is not initialise as git repository then:
cd dw-ng2-app
git add --all
git commit -m "commit message"
git push -u origin master
-If already initialise with git repository.
First of all go to directory dw-ng2-app : cd dw-ng2-app
add remote to your repository.
git remote add bitbucket https://username#your.bitbucket.domain/yourproject/repo.git
push the changes:
git push -u origin master
here's master is name of branch in which you want to push the content.

Integrate Projects in a single project

I have same xcode project on two deferent macbooks with different code.we need to merge that code but we are not using any git account.We need to merge same file as well,I mean we have same viewcontroller and added two people add a code in single view controller How i can merge it.
For example:
I have a view controller Name "XYZ"and Person 1 added "Login Method"
into "XYZ" and person 2 added "Sign up Method" into XYZ. and both code
are on deferent macbook without any git account how I can merge
that.
Since you use the git tag, I will provide the way to do version control by git.
First, please sign up account for bitbucket (free for private repository) or github (only free for public repository). And create a repository. They are as the remote git repository(repo).
Then use git bash for local repository.
In one macbook, use these steps:
git clone <URL for your bitbucket or github repo>
cd reponame
copy your xcode project in reponame folder
git add .
git commit -am 'code version from first macbook'
git push
Now the code in the first macbook is pushed in your remote repo.
In the other macbook, use these steps:
In an empty folder, use git init
copy your xcode project in this folder
git add .
git commit -am 'code version from second macbook'
git remote add origin <URL for your bitbucket or github repo>
git pull origin master
Now the code from macbook1 is merging in macbook2
If there has conflict files, you should check and save them, and then use git add . and git commit -m 'solve merge conflict'.
Now this is the version that you merge the different macbooks together. You can push the version in remote repo by git push.
More git related, you can refer git book.
Any version control system comes to handy in this kind of situations. Merging manually is the option available other than version control system. Either merge using version control system like git or manually merge the files which is very hard to workout.

Rails: Rubymine: GitHub

I can't seem to figure out how to commit my files to GitHub.
I am using RubyMine 4.5 on the MAC
I have git set up locally
I have a private account on GitHub
From the RubyMine Preferences, I have my GitHub credentials properly set up (and acknowledged as such by RubyMine), but it did not give me an option to select a repository on GitHub.
How do I commit file to the GitHub repository? There are too many CVS and Git menu items in RubyMine.
PS: I've read the online help sections (the only thing available to me), and I followed the instructions in the GitHub integration, but the directory I'm trying to commit is failing to push to GitHub, with RubyMine telling me that there was nothing to commit. This is the first time I use RubyMine for GitHub. Nothing about this on StackOverflow.
Okay, I think I've recreated your situation locally and it appears that RubyMine has terrible support for managing remotes. If you create a Git repository locally, then (separately) create a repository on GitHub, there's no obvious way to marry the two from within RubyMine.
Basically, you need to set up GitHub as a remote for your local repository from the shell, and once that's done then RubyMine will be able to push as normal.
Please note that the below instructions assume you want to overwrite your GitHub repository with the full history from your local repository -- If your GitHub repository has data that you do not want to lose, do not execute these commands! See Below.
Open up Terminal:
cd /path/to/my/project/root
git remote add origin https://github.com/yourusername/yourrepo.git
git push -u origin +master
Now, RubyMine should be able to push to your GitHub repository via VCS > Git > Push
If your GitHub repository has already been committed to and you don't want to lose those changes, you'll need to either create a new GitHub repo or clone your GitHub repo into another folder and merge your local repository into the clone.
This can be avoided entirely if you're trying to push your existing local repository to a new GitHub repo: Simply use the VCS > Import into Version Control > Share project on GitHub option and use the dialog to create a new GitHub repository.

Resources