Branches are independent lines of development allowing devs to work on features, fix bugs and test stuff without the risk of disturbing the main line (master branch). With Buddy, you can create, merge and manage branches in a just a few clicks.
- Go to your project and click the Code tab.
- Switch the tab to Branches and click the
- Provide the name, description (optional), and set the starting point from the dropdown menu (branch, tag, or commit).
- Click Create new branch to proceed.
Creating a new branch
- Go to Code tab and switch the tab to Merges.
- Click the Merge button on the right and choose the source and target branches:
- When ready, click Merge now.
Branch comparison details before merge
What you need to know about merging branches
- You can merge two branches only if there are no conflicts between them
- The comparison status shows you the number of commits ahead (green) and behind (red) the selected branch
- If you do not have permissions to push to the selected branch, you can reate a Merge Request instead
You can change the default branch for the repository in the Branches tab by using the hamburger menu next to the branch's name. This branch will be default when you clone the repository, or when you browse the source in Buddy.
Changing the default branch
Push permissions allow you to restrict write permissions in a specific branch in the repository. Here’s how:
- Go to Code, switch the tab to Branches, and click the branch that you want to restrict.
- Enter Permissions tab and select who’s allowed to make pushes.
You can back up a branch in your repository by adding an SSH command that will trigger the upload of the newest version to a server after every push to that branch. Here’s how:
Execute the following on the server where you want to keep the data:
mkdir backup cd backup git clone --mirror repo_url_ssh$$$
- Open the project that you want to backup and go to Pipelines
- Add a new pipeline in the automatic mode and add the SSH action
- Provide the details of your server and set “backup/repo” as the working directory
In the command field type the following:
git remote update$
Once you save, the backup will be performed automatically on every push to the branch.
Last modified on February 12, 2024