On creating new Git repo section for new development

Talk about code development, features, specific bugs, enhancements, patches, and similar things.
Forum rules
Please keep everything here strictly on-topic.
This board is meant for Pale Moon source code development related subjects only like code snippets, patches, specific bugs, git, the repositories, etc.

This is not for tech support! Please do not post tech support questions in the "Development" board!
Please make sure not to use this board for support questions. Please post issues with specific websites, extensions, etc. in the relevant boards for those topics.

Please keep things on-topic as this forum will be used for reference for Pale Moon development. Expect topics that aren't relevant as such to be moved or deleted.
User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

On creating new Git repo section for new development

Unread post by moonbat » 2022-10-31, 02:27

I want to create a separate section to recreate one of my extensions in a different manner without affecting the existing code, and later replace the master branch with it. I find Git pretty confusing in this regard, most of what I found searching is task specific when I don't know what tasks I need to perform.

All my extension repos simply use the master branch. How do I go about creating a separate section (branch or tag, I don't know which) so that I can recreate my extension independent of the main branch, and how do I later replace the original master branch with this one (and move that to a legacy branch)?
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1498
Joined: 2018-10-28, 19:56
Location: Georgia

Re: On creating new Git repo section for new development

Unread post by athenian200 » 2022-10-31, 07:54

You could use:

Code: Select all

git checkout -b new_branch
To check out a new branch. Once you're on the new branch, you can do whatever you want to the extension and it won't affect master.

You can make as many copies of master as you want with different names, actually. That is actually a key part of using Git effectively... create a separate branch, do your work on it, and then merge it into master once you decide it's ready. You can also use tags or branches to preserve the state of the master branch at various points in development so you can easily step back and look.

It sounds like you need to... git gud, as gamers would say. ;)
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35475
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: On creating new Git repo section for new development

Unread post by Moonchild » 2022-10-31, 09:14

If you're new to git and working in a branching repository structure, having a GUI for it will help a lot.
I do my branch work in SourceTree (an old version before Atlassian completely screwed up their UI to be "more modern", v1.5.x)
In the attached image, the "flow" direction in the upper right graph is up. you see a split being made into a branch, then a few merges back into master. The bottom part is information about the highlighted commit in the flow graph. left-hand side allows you to quickly jump to selected branches or tags in the flow graph. Tabs show the repositories I have open here (too many, I should close a few... ;P)
Attachments
st1.png
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Locked