How to commit hg repo with GIT submodule which should be read only? - xcode

my Hg repo now needs to include a Git submodule (Restkit) as per the advised method in the site wiki.
However, I am not updating the git contents and should only be potentially reading/pulling in changes from the host.
It appears that when I came to make my first push of my main Hg repo it baulked at the Git one asking for a password. I think this may be because its attempting to authenticate against the Git site as well.
My questions are can I arrange this so that the Git repo is read-only(pull) or even static and/or get round the log in issue. Obviously the two different repos have different credentials.
Thanks.
P.S. using Atlassian SourceTree 1.5.3 on OS X 10.8.2, Xcode 4.5.1
I've just re-read this;
2.6. Synchronizing in subrepositories
Subrepos don't automatically track the latest changeset of their sources. Instead, they are updated to the changeset that corresponds with the changeset checked out in the top-level changeset. This is so developers always get a consistent set of compatible code and libraries when they update.
Thus, updating subrepos is a manual process. Simply run 'hg pull' and 'hg up' in the target subrepo, test in the top-level repo, then commit in the top-level repo to record the new combination. The onsub extension can be used to automate that.
Assume this means its not pulling the sub? but I still have the above issue of the password request.

You moved in the right direction, but not finished all required steps.
You have to have subrepository, create it by hand... and don't mix real subrepository with a) independent b) nested repository
When you'll convert nested to subrepo push into master repo will not perform push to subrepo (except it requested)

Related

How to ignore an incoming commit

I want to have two separate versions of a file: One on github and one on my local machine.
More specifically, how do I ignore a commit coming from the remote server. In this particular case, I modified the file on github, committed it, but I want it to not change on my local machine.
I put the readme file on .gitignore.
Changed the file on github.
Made a commit
Fetched the commit on my local machine using VS2017.
How do I "ignore" the commit. And keep the two versions separate.
You can at least try:
git update-index --skip-worktree -- README.md
As I mentioned here, that would resist a git pull.
And you would keep a local version of README.md, different from the tracked one from GitHub.
I don't presume to know if it is a good idea or not, in your particular situation.

How to pull files from github branch to xcode directly?

I have a project created for me by teacher and I have to improve it. He created a repo on Git Hub with branch for me. I'm trying to pull the project files from that branch directly to Xcode and Xcode refers to the branches that I have created which are empty, not the master one. Can't find any adequate manual for that as well... Please help...
so github uses git to manage repositories, so this question has more to do with git than with github.
Git is a distributed-repository source-control system, which means that every machine has a full copy of the repository, with all of its history and branches. This means that your local repository that you cloned from GitHub has all of the branches on it.
So, your problem is actually just that you need to switch branches locally to the branch your professor created.
In a terminal you can execute
git checkout <the-name-of-the-branch-your-teacher-created>
and that should do it. :)
Xcode is simply looking at the files in your working directory, so switching branches will update the files in Xcode as well.
For more git information check out the git book or any of the other countless git resources online!
Well using Git is fairly simple and as specified above can pull the project (either complete of specific brach and then import it.
OR
While running Xcode you can follow below steps -
Click on Check out an existing project.
Enter Repo link as shown below and hit Next.
Select the branch that you want to pull and hit Next.
Note As shown in Image Xcode version 8.2.1 is used.

How do I update the /app folder when Laravel is updated?

Sometimes I have problems with my Laravel project after running composer update. I believe this is caused by changes in the Laravel application skeleton (https://github.com/laravel/laravel). How do I update my local project to reflect those changes?
From the awesome forum post on the Laravel forums by Kindari (http://forums.laravel.io/viewtopic.php?id=5367):
If you originally cloned this repository and still share a git history
with it, you can usually merge in changes easily. Assuming your remote
is 'upstream' pointed at this repository, you can do the following:
git fetch upstream
git merge upstream/develop
Alternatively you could cherry pick in individual commits
from the develop branch, but I won't cover that here.
If you downloaded the zip distribution originally or
removed the upstream history, you can still resolve your problem
manually. Look at the commits on this branch and make any changes not
present in your application. Usually the breaking changes are simple
configuration changes.
Since most of the changes are likely to be simple configuration changes,
another option is to do a diff on the root folder and the /app folder. You'll mostly see your own configuration, but you'll also see any new configuration items that you should add.
I usually use git pull request. A git pull request does a git fetch followed by a git merge. It works for me nicely. In other words, A git pull is what you would do to bring your repository up to date with a remote repository.

xcode git unable to pull changes from the remote repository

I'm developing an iPhone application with another developer. Our git repository is situated on the remote server.
So we are working with our working copies and then we do commit, pull, push one by one and we get our local working copies synchronized with server and with each other.
Everything worked fine until this day. Other developer successfully pushed his changes to the remote repository, and now it is my turn: commit, pull changes from the remote repository, maybe merge them somehow and then push my working copy to the server.
But when I'm trying to pull changes (using xcode's built-in git) I'm getting an error:
"The operation could not be performed because "%reponame%" has one or more tree conflicts".
Please, guide me through the process of solving this problem. And, please, provide useful tips to avoid this problem in future.
I guess xcode uses option to force fast-forward merges when pulling from repository. That is not bad idea, becouse it prevents you from undesired merges.
Try to use git pull --rebase (resp. check some appropriate checkbox in xcode), it should remove your changes, download new version and then apply your removed changes back. Conflict will occur at the last step so you will solve it and commit that changes again. Then you can push them on server.

Git submodule mess: how to use git submodules with developers not familiar with git?

I am really frustrated about using git's submodule feature. Either I still don't get it right or it just don't work as I am expecting this. Following project situation is given:
Project
| .git
| projsrc
| source (submodule)
| proj.sln
In this scenario source is pointing to another repository containing the common source data across all our projects. There is a lot of development happening under source as also under projsrc. Unfortunately Project points to some commit of the source submodule and not to the actual HEAD of it. This is the usual git behaviour, as far as I got it know.
I already found out that
git submodule update
just get the version of submodule which was commited together with the main Project. However, I would really like to be always up-to date with the submodules development, but do not have any real clue how to do this right. Hence my question is:
Is it possible to attach the Project to the HEAD of the submodule,
reagardless of the fact if this will break the compilation of Project or not.
I just don't want to go always into the submodule
directory and do git pull there. Since I think I could loose my changes done
in the submodule directory, because this is simple attached to a
commit and not really to any branch or so.
Please consider following constraints:
Developers in our group are not that familiar with all VCS around. We are used to use really huge svn repository before, without any external repo features at all.
We are working on Windows
A click'n'forget solution would be best, since most of project members are rather scared by using a command line interface :)
The reason why a submodule points to a particular revision is important. If you point to a HEAD, builds will be unreproducible. I.e. if you checkout yesterday's a version of the Project, you would never know which exact version of source#HEAD was yesterday.
That's why it always stores particular revision sha.
To pull all submodules you could use Easy way pull latest of all submodules
I am not good at Git and submodule. But I think some simple rules would be very helpful.
Commit and push from sub-directory.
Go back to root of your project, check the status if you need to commit and push again.
when Pull. can try to use script to bundle the "pull/submodule update" together. And only do it at the root of your project.
Consider this:
source is pointing to HEAD (as you would want).
you make changes to source inside you Project (you commit but not push them)
now you have two HEADs : one in your Project's source, another in your common source.
Which one you would want to be present in your Project when you make submodule update?
The problem (and the main feature) of git in your case is that you consider commit and push as atomic operation. It isn't. Git is decentralized. There is no common HEAD. You might have multiple repositories with different HEADs.
Consider this:
you have 3 developers (A, B and C) with a git project.
they all pull a project's HEAD.
each developer has made changes to project
now each of them has 3 HEADS: A HEAD, B HEAD and C HEAD.
Which HEAD you consider "true" HEAD?
So, to answer your question: If you want common source submodule always be synchronized with central repository, git isn't your choice. And probably none of VCSs would help you with that.
You should treat git submodule as a thirdparty library which should be updated manually with these two steps:
Pull your submodule ("download thirdparty library")
Commit your project with updated submodule ("place the new version of thirdparty library to your project")
If you want to make changes to submodule you should do the same in reverse order:
Commit your submodule ("make your changes to the thirdparty library")
Push your submodule ("send your changes to the thirdparty library maintainer")
Commit your project with updated submodule ("place the new version of thirdparty library to your project")

Resources