I wanted to create a git clone of a big svn repo with git-svn.
My primary problem however is that whenever a new branch is created, the whole history is re-downloaded:
"Found possible branch point" and it starts downloading from r1 ('til 40000...).
How can I (and why do I have to) tell git to skip the commits that were already fetched?
Thanks,
LÅ‘rinc
Related
Im a bit confused about these scenarios:
I have a task.
I create feature branch, make work here.
And then I create Pull Request to release-test branch.
In order to avoid conflicts, first I have to update my feature branch. So I have to merge release-test into feature.
But in this case, in my Pull Request I will have a lot of merged commits which I don't want to have. I want only my feature branch commits in PR.
What should I do in this situation?
I pushed my feature branch and then conflict appears in PR. What are my next steps?
I tried to revert to the last commit, made compare with release-test branch, then force push. Is this a good practice?
P.S. I'm using Intellij Idea if this would help
In order to avoid conflicts, first I have to update my feature branch. So I have to merge release-test into feature.
Don't: you should always merge from specific to integration branches, not the reverse.
Your feature branch is a specific branch (specific for a given task you are isolating in its own branch)
release-test is an integration branch (where multiple branches come to be merged)
If you need to update your feature branch compared to release-test, rebase it:
cd /path/to/local/repo
git switch feature
git fetch
git rebase origin/release-test
# resolve potential conflict there
git push --force
That will guarantee there won't be any conflict in your PR (automatically updated after the push --force), since your feature branch will only add new commits on top of the most recent remote release-test branch.
I am working on a project, using Fossil for version controlling and organizing it. I have some branches other than my main trunk branch, and want to update (commit) only a single branch. Doing commit will push my changes on a branch to the main Files (i am hosting my project on Chiselapp)
. How is it possible to update or commit only a single branch without affecting the main files?
A commit only ever affects a single branch. Except perhaps after merging two branches, but I'm assuming you haven't been doing that.
The only thing I can think of is that the skin you're using has a "Files" menu item that links to dir?ci=tip. The tip is a special name for the most recent commit. Which means that, if you make a commit in a different branch than trunk, that "Files" menu item will now show you the files of that other branch.
The hackish temporary way to fix that is to make a commit in trunk afterwards, so that tip refers to trunk again. But that's not ideal.
The easiest way to permanently fix this, is by choosing a different skin which doesn't do that, or by editing your skin's header, and replacing the link to dir?ci=tip by another link, dir?ci=trunk for example. That way, that menu item will always show the files in the trunk branch.
Fossil unlike Git pushes/pulls all branches and tags at once*. The reason (apart from being by design) is that Fossil repository is a database, push/full synchronizes the database in the respective direction.
This means if you committed changes on several branches then all of them will be pushed to the remote.
*UNLESS, the changes are done on private branches (see fossil help for fossil commit --branch --private, fossil branch new --private).
Private commits/branches by default are excluded from push/pull. To also include these use --private option (see fossil help for fossil push --private).
Once the changes have been pushed, they are integrated in the remote repo and can be viewed in the remote repo's web-GUI as individual commits or via the branch to which they belong. The view includes the Files section that reflects the repo contents (snapshot) at the commit's version.
To answer your question: if you committed changes to existing trunk branch, they will be pushed to the remote trunk as well. If you don't want to make changes to the remote trunk, then make your changes in your new branch (to be pushed as a new branch) or in your private branch (will NOT be pushed by default).
I have a long standing patch branch and a develop branch. I want to cherry-pick specific changes from develop to the patch branch.
When I do, I get new commits with no link to the old commit.
Is there a way to cherry pick and maintain the parental link to the branch for that commit?
is adding "-x" the best I can do?
Thanks
Yes, -x is really the only way to reference the commit that you cherry-picked.
If you want to maintain the parent relationship of your commits, you would need to merge the branches. My guess would be that you would want to merge the patch branch with the develop branch so that you keep your work properly segregated.
Though based on the way you phrased the question, I think that you might have a misconception about commits. They don't have a "link" to a branch. Rather each commit has a single parent commit that they point to. Merge commits have multiple parents to show which commits they are merging together. A branch is really just a pointer to a commit. A commit can exist on multiple branches either because it was merged or you created a new branch based from it or a later commit.
What git cherry-pick does is make a copy of the changes that you made on one branch and apply them to a different location. You do this because you don't want the rest of the history coming along with this particular change. If you want to maintain a history, you would git merge or git rebase the changes from one branch to another.
Quite often I will start coding a feature on our trunk (AKA HEAD) and after starting to change the code realize that I probably want to do this on a branch. This is fairly easy to do, I simply create the branch with something like:
cvs rtag forkName all
cvs rtag -b branchName -r forkName all
Then from my modified workspace I morph it into the created branch:
cvs up -r branchName
The problem I'm having is that any file that has been added previously is not morphed over to the branch but remains "added" to the trunk.
To fix this, I've gone into the CVS/Entries file and appended the branch tag to the added file entries (don't try this without parental supervision kids).
Is there a better way?
Since your CVS repository does not know about your new files, they keep being added to the trunk. If you would commit them using:
cvs commit -r branchName
they should get the branch tag and any further commits can be normal.
I need to hire some freelancers but not allow them to see previous commits, just the current state. So Id like to clone a private repo on github of mine, remove the .git commit history, add the clone repo to the github account as public, have freelancers fork that repo and send pull requests with their changes. Then pull the changes back to my original private repo with my entire commit history.
Whats the best way to do this? Thanks
I don't think you'll be able to pull the changes all the way back to your private-repo-with-full-history, because you want the public-repo and the private-repo to effectively have different root commits.
I think your best bet might be:
Take a snapshot of your repository with git archive.
Use that as the initial commit on your new public-repository (thus squashing the history).
Allow developers to fork, work and send pull-requests as discussed.
Copy the commits from the public-repository to the private-one using one of the following:
git format-patch in the public-repo, git am in the private-repo
Add both remotes, and git cherry-pick individual commits
Add both remotes, and git rebase your public branch(es) onto your private one(s); you should probably have a Very Good Understanding Of How Rebase Works before trying this.