How to download the different branches
-
What are the different development and release branches of FOG and how does one download each?
-
Branches in GIT allow developers to separate code into elements while leaving other elements alone.
Typical structure for a repo in GIT will have at least 2 branches.
The first branch is typically
master
. This is the “top” level branch typically containing the current “stable” software version.
The second branch can be named nearly anything, and essentially would be akin to subversion’strunk
. Some GIT repos model their repos off of this and have atrunk
branch. This might be where the next development work is at.FOG’s structure is:
master
The current stable release.
dev-branch
the current RC release.
working-1.3.4
the development for the 1.3.4 version (currently.
newIpxeGeneration
A branch where I’m refactoring ipxe menu generation.
persistentGroupPlugin
A branch where i am (kind of?) working on a new model to the persistent group sql trigger stuff.In git you clone a repo with a command like:
git clone https://<url>/<repoowner>/<reponame>[.git]
For fog this would be:
git clone https://github.com/fogproject/fogproject.git
(The .git part is optional but normal to add as well.)This will download whatever is the “default” branch to download. In FOG’s perspective, the default is
master
(now).You do not need to “clone” the repo every time, it is only needed to initially download the repository information if you have not done so already.
If you’ve already retrieved the repo, you just cd into the base path. More often this might be
/root/fogproject
.Once in the base path you can change branches. To get a list of all branches available you would run
git fetch --all
To view available branches run:
git branch
The one with the * is the branch you’re currently on.To switch to one branch or another run:
git checkout <branchname>
So to switch from the master to dev-branch in our scenario you would run:
git checkout dev-branch
Hopefully that helps answer that.
As a word of caution I’d also highly recommend always running
git pull
when you change in and out of branches. This will pull in any new changes. -
Thank you for this great info. How about svn or is it not being used anymore?
-
@sudburr tom told me a while back that since 1.3.0 svn is only getting updated with releases.
It doesn’t hurt to know how to use svn, it can be helpful. But I would recommend using git.
You can find lots of info online about subversion (svn).
-
Thank you for the update regarding the SVN repository’s repurposing. This is all good to know.
-
Looks like you mean to say the following to list available branches:
git branch -a
-
@sudburr This would do the same but give dates and no-longer active branches too. The count is adjustable. This is a snippet from something I’m working on.
git for-each-ref --count=10 --sort=-committerdate refs --format='%(committerdate:short)_%(refname:short)'