A sample demo on github banching techniques
Published on September 25, 2020 by Suraj Kumar
github branching practices
4 min READ
Best branching methods followed by the industry. Please share if you know more.
We use this functionality to mark release points (v1.0, v2.0).
Listing the existing tags is simple
.
git tag -l # -l is used for list the tags
git tag -l "v1.8.5*" # here it will all the tag list containing v1.8.5
Two types of tags are basically suppported in github.
Lightweight :- A branch that doesn’t change — it’s just a pointer to a specific commit.
Annotated :- . They’re checksummed. contain the tagger name, email, and date; have a tagging message. It’s generally recommended that you create annotated tags so you can have all this information.
# TO create a git annoted tag.-a when you run the tag command.
git tag -a v1.4 -m "my version 1.4"
git tag
git show v1.4 # You can see the tag data along with commit.
git tag v1.4-lw
git tag
git show v1.4-lw
tag commits after you’ve moved past them
git log --pretty=oneline
git tag -a v1.2 <Your commit checksum>
git tag
git show v1.2
By default, the git push command doesn’t transfer tags to remote servers. You will have to explicitly push tags to a shared server after you have created them. This process is just like sharing remote branches — you can run git push origin
git push origin v1.5
# if you have lots of tags and want to commit
git push origin --tags
# or
git push <remote> --tags
To delete a tag on your local repository,
git tag -d <tagname>
git tag -d v1.4-lw
# This does not remove tag from any remote server
git push <remote> :refs/tags/<tagname>
git push origin :refs/tags/v1.4-lw
# The alternative way to delete a tag is
git push origin --delete <tagname>
git checkout develop
git fetch
git pull
git checkout -b feature/PROJECT-XXX # here xxx can be canged with ticket number
git request pull ...
Multiple branches and setup is created to practice branching techniques.
Branching is a core concept in Git, and the entire GitHub flow is based upon it. There’s only one rule: anything in the main branch is always deployable.
Because of this, it’s extremely important that your new branch is created off of main when working on a feature or a fix. Your branch name should be descriptive (e.g., refactor-authentication, user-content-cache-key, make-retina-avatars), so that others can see what is being worked on.
Commit messages are important, especially since Git tracks your changes and then displays them as commits once they’re pushed to the server. By writing clear commit messages, you can make it easier for other people to follow along and provide feedback.
Pull Requests are useful for contributing to open source projects and for managing changes to shared repositories. If you’re using a Fork & Pull Model, Pull Requests provide a way to notify project maintainers about the changes you’d like them to consider. If you’re using a Shared Repository Model, Pull Requests help start code review and conversation about proposed changes before they’re merged into the main branch.
Pull Request comments are written in Markdown, so you can embed images and emoji, use pre-formatted text blocks, and other lightweight formatting.
Once your pull request has been reviewed and the branch passes your tests, you can deploy your changes to verify them in production. If your branch causes issues, you can roll it back by deploying the existing main branch into production.
Just a simple log is not cool
Just remember A Dog
git log –all –decorate –oneline –graph