I have a problem how create releases in our public or private repository in GitHub ? How to do it using windows cmd or linux terminal ? Is there any special commands for that?
3 Answers
The example below show You how to made a single release cycle, first you should create a central repository, then you create a develop branch.
You create a develop branch
git branch develop
git push -u origin develop
This branch contain the complete history of your project, now whereas your master
contain new version. Your team should now clone the central repository and create a tracking branch for develop.
You create a tracking branch for develop
git clone ssg: //user@/path/
git checkout -b develop origin/develop
Everybody now has a local copy of the historical branches set up. So You decide to make a new feature. For that you create separate branches for your respective features with base as your develop branch.
You begin a new feature
git checkout -b some-feature develop
You can to add commits to the feature branch as You wish, then:
git status
git add <some-file>
git commit
You finish your feature
After adding new features, You decides that your feature are ready, now You can merge it into your local develop
and push it to the central repository, like so:
git pull origin develop
git checkout develop
git merge some-feature
git push
git branch -d some-feature
The first command makes sure the develop is up to date before trying to merge in the feature. Note that features should never be merged directly into master
.
You begin to prepare a release
While others develop's working on his feature, You can start to prepare the first official release
of project, You can to use a new branch to encapsulate the release preparations. This step is also where the release's version number is established:
git checkout -b release-0.1 develop
This branch is a place to clean up the release, test everything, update the documentation, and do any other kind of preparation for the upcoming release. It’s like a feature branch dedicated to polishing the release.
You finish the release
Once the release is ready to ship, You merges it into master and develop
, then delete the release branch.It's important to merge back into develop
because critical updates may have been added to the release branch and they need to be accessible to new features. Like so:
git checkout master
git merge release-0.1
git push
git checkout develop
git merge release-0.1
git push
git branch -d release-0.1
You should know that release branches act as buffer between feature development and public releases. Is good idea that whenever you merge something into master
, you should tag the commit for easy reference:
git tag -a 0.1 -m "Initial public release" master
git push --tags
If you want a better explanation, visit this link: https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow.
-
This is great! .I'll be check your solution as soon as possible and thank you again. This is what I want ! Commented Jul 30, 2016 at 18:41
-
Aha! I've confused about the git checkout command and your answer has great explanation about that! Commented Jul 30, 2016 at 18:48
Releases are a feature of GitHub, and are not a feature of general git
(similar to other Github extra features like Issues and Pull Requests). However, people have created projects that allow you to create GitHub releases from the command line. The following are a few that I could find:
Go (golang) Implementation of GitHub releasing: https://github.com/aktau/github-release
JS Implementation of GitHub releasing: https://github.com/ungoldman/gh-release
-
1Thank you very much for the info . This is interesting and really helpful ! Commented Jul 30, 2016 at 16:11
How to do it using windows cmd or linux terminal ? Is there any special commands for that?
There is, using the GitHub CLIP gh
that you need to install first.
Since gh
2.19.0 (Nov. 2022), you can do, using gh create release
:
Support explicitly marking a Release as "
Latest
" by @mislav in #6538Example:
cd /path/to/local/repository gh release create v1.3.0 --latest --target=main --notes "" gh release create v1.2.1 --latest=false --target=1.2-stable --notes ""
This helps considering since Oct. 2022, you can explicitly set the latest release to any version you want.
Previously, a repository's latest release was the one created on the most recent date. In the event that multiple releases had the same date, the semantic version number broke the tie.
This new feature provides an explicit toggle to mark a release "latest" when you create it.