Forum > General

Branches

<< < (2/6) > >>

Thausand:
OK, so make sure I/we understand:
You have not create fork with gitlab account ? but use clone with local git command ?

If is so, then that is problem.
a. Then you need create fork, then make changes from own repository to fork, then create merge.
or
b. make patch and upload patch to FPC issues

I think you not want b. and i not know better way for a.

link fork: https://docs.gitlab.com/ee/user/project/repository/forking_workflow.html

--- Quote ---A fork is a personal copy of the repository and all its branches, which you create in a namespace of your choice. This way you can make changes in your own fork and submit them through a merge request to the repository you don’t have access to.

--- End quote ---

Martin_fr:
How did you create your fork?
1) by pressing the fork button in the web interface of Gitlab?
2) by making a local clone, and then importing this to a new Gitlab.
3) by downloading sources, and creating a new git from it (not a fork)

In case of 1 it should work. 2, I have never tested.

In case of 1, when you go to "new merge" request, it should have one your branches pre-selected on the left, and one of the lazarus repo on the right.

In case of 2 see the post by Thausand.

Or never mind that... If it doesn't work, you can add a normal issue, with a link to your branch (and a note that gitlab didn't let you do a merge request). That would be a classic "pull request" => a request to pull your branch, and integrate it.
That is ok in case of 2, but not 3.
In case of 2 commits that came from the original repo, have the same sha1.

So when any dev pulls your branch, git will see the matching sha1, and it becomes a normal branch in their local repo.
I do that with most merge requests too, so I can test them before merging.

It's a bit more work for the developer, without a merge request, because your commits need to be changed, so the committer will be a developer (or they can't be pushed, due to security settings). Mind, only the committer. The author is kept as you.
So it depends who of us would be to look at them, and how git savvy that person is.


SymbolicFrank:
I just made two new repositories on Gitlab and supplied the URL of FPC Source and Lazarus. And made a local clone of those, which do understand that they are linked to the remote one.

But half the idea is to keep things running while branches aren't merged yet, so I have to be able to pull the originals. And the idea of a Gitlab copy is to make it easy to create a merge request and check it out, right? So I can contribute my own fixes and improvements.

I'll probably have to redo everything in that case.

I always feel stupid when I have to work with Git-wrappers. I barely understand the internal logic of Git, if it comes to that. Ah, well, it works for Linus and we just have to get used to it, I guess.

I have enabled mirroring, but that doesn't work.

Thausand:
@Martin_fr:
Thank for more information. Some projects not like when not have fork. good know FPC is ok with no fork.


--- Quote from: SymbolicFrank on July 05, 2022, 01:08:25 pm ---But half the idea is to keep things running while branches aren't merged yet, so I have to be able to pull the originals.

--- End quote ---
Gitlab have mirror function to keep up date but is pay option. So we need do self:

edit: This is use when not have local copy on machine. Martin_fr write below write when have (always) local copy on machine

1. make local clone of fork project:

--- Code: ---git clone https://gitlab.com/<username>/<repository.git>

--- End code ---
2. update local clone of fork repository with upstream and push back (if is FPC source fork)

--- Code: ---git remote add upstream https://gitlab.com/freepascal.org/fpc/source.git || true && git fetch upstream && git checkout main && git pull upstream main && git push origin main

--- End code ---


--- Quote ---And the idea of a Gitlab copy is to make it easy to create a merge request and check it out, right? So I can contribute my own fixes and improvements.

--- End quote ---
If want longer/more fixes then I think that better, yes.


--- Quote ---I always feel stupid when I have to work with Git-wrappers. I barely understand the internal logic of Git, if it comes to that. Ah, well, it works for Linus and we just have to get used to it, I guess.

--- End quote ---
Stupid is wiki write about svn and mantis so not know what to do and figure out self. So please no make feel stupid yourself. I not know gitlab and have try 5/6 time before I understand  :'(

Martin_fr:

--- Quote from: SymbolicFrank on July 05, 2022, 01:08:25 pm ---But half the idea is to keep things running while branches aren't merged yet, so I have to be able to pull the originals. And the idea of a Gitlab copy is to make it easy to create a merge request and check it out, right? So I can contribute my own fixes and improvements.

--- End quote ---

The local clone of your fork can have several remotes.


--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---git remote add official   https://gitlab.com/freepascal.org/lazarus/lazarus.git
The default remote is called "origin".
You may have seen that when you referred to remote branches as origin/main.
Now you have origin/main and official/main.


Then you can specify the remote in git pull and push. They are also associated to branches, so once set up, you don't need to care.
Easiest to be done, with a GUI frontend.


--- Code: Bash  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---git pull origin
When you create a new branch
   git switch -c my-branch origin/main

you can push with
   git push origin
or
   git push origin my-branch


Afaik if you don't change it, origin will be your default push destination.
And you can't get it wrong, because you will get an error if you try to push to the original repo.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version