SourceTree Merge Multiple branches - branch

I have multiple branches created under my master : Branch 1, Branch 2, Branch 3, etc.
Each branch has his own code. But how i can merge all my branches and have a commun code ?
So far when i checkout a specific branch, i only have the code for that branch.
I'm using SourceTree

You can Pull from the remote copy of each branch into your master branch. Make sure you are up to date and then Checkout your master branch. Choose Pull and then select your remote branch to pull from.

Related

Alembic - Create sequential migrations

My Git flow consists of develop, master and feature branches. I use Alembic for database migrations, and I run migrations only after merging branches into master.
Currently, merging a branch containing migrations into develop causes trouble. Here is the problematic process:
New branch off of develop (BRANCH 1)
Create migrations in BRANCH 1
Merge BRANCH 1 into develop
The migrations aren't being run because they are not in master
Another new branch off of develop for a different feature (BRANCH 2)
Now, it's impossible to create migrations in BRANCH 2 - I get Target database is not up to date because the head revision is the new revision created in #1, but the database has not been upgraded yet.
Running alembic history gives:
c4892151a825 -> 3451e691af8a (head), BRANCH 1
c4a0d473218e -> c4892151a825, MASTER MIGRATIONS
What I'm trying to achieve is to have the two migrations run sequentially:
c4892151a825 -> 3451e691a4jf BRANCH 2
c4892151a825 -> 3451e691af8a BRANCH 1
... -> c4892151a825, (head), MASTER MIGRATIONS
I tried running alembic revision --head c4892151a825, but it says that the revision is not a head revision.
I found a temporary solution:
move BRANCH 1 migration file to a different location
Create a new revision.
Return the migration file to the previous location and merge the two using alembic merge.

How to delete multiple branches in GitKraken?

I have more than 70 local branches in GitKraken and I want to delete some of them.
Is there any way to delete multiple branches in GitKraken client?
I do not think there is a way to delete multiple branches at once in GK at this time.
You might want to use a terminal like git bash for this (File -> Open Terminal in GK if a terminal was set up in Preferences). See this answer on how to delete multiple branches with one command via command line.
You can delete multiple branches when they are inside a folder.For example feature/add-search
That way, you can right-click the feature fold and delete all branches which are inside the folder.
Select branch
Press and hold Ctrl
Select another branch
Right-click on the selected branch
And select 'Delete n local branches'

How to prevent in GIT sql files from merging into main branch

Basically I have two branches, main and branchA. In branchA I add sql files, so that GIT tracks their changes. But when I merge this branch back to main, I want the main branch to ignore all sql files. Basically, I don't want the main branch to even have sql files committed, since they should only exist as development aids. Is this possibly?
After committing the sql files in your branch A, you can add these files in gitignore and commit it.Or, in main branch, you can execute the following git command to ignore these file changes:git update-index --no-assume-unchanged

How to have 2 Different Liquibase Deployments on the same source object

I am complete Noobie in Liquibase (and jenkins) deployments.
We have a SQL table which can be modified by 2 separate git repositories. We have one liquibase based deployment for this table for each of the git repos.
ISSUE:
Liquibase will try to update the DATAGBASECHANGELOG after each deployment. Thus breaking the cycle of continuity between 2 commits in the same git repo.
E.g.
We have a table A, the script for which is A.sql and it is in two repos X and Y. The table script can be modified in either of the two repos X or Y. Now if I do the first deployment using the repo X, second using repo Y and then change the file A.sql in repo X, then next repo X deployment with fail because of mismatched changesets.
What we think can solve this is that we need to have 2 different DATABASECHANGELOG tables for each repository deployment?
Any help or pointers will be of great help.

Mercurial - Is it possible to merge changes from the trunk to a branch, within the same repo?

Mercurial - Is it possible to merge changes from the trunk to a branch, within the same repository?
If yes, is it possible with TortoiseHg?
There are two things you can do, merge or transplant. These answers assume the command line, you may have to search through your menus in tortoise to find similar functionality.
You can merge all the changes from one branch to another. The procedure for this is:
hg update mybranch
hg merge default
hg commit -m "Merging with default"
This will bring all commits from default into your branch, but not the other way around. Later you can reintegrate your branch with default by doing the opposite
hg update default
hg merge mybranch
hg commit -m "Bringing in changes from mybranch"
If you want to bring in one or more specific commits that were committed in another branch, you can do that with 'transplant', which is a mercurial extension.
# reqiured in ~/.hgrc
[extensions]
transplant =
These are the commands you can use to use transplant:
hg log | less
# (find revision number, the part after the colon, i.e. "88660cca467d")
hg update mybranch
hg transplant 88660cca467d
# (no commit required)
As #Jerub said, you can use merge and transplant to get change sets from one branch to another. With TortoiseHg you can do a merge by opening the "repository explorer", then select the first revision to merge, and afterwards right click on the second revision to merge. Chose the "Merge with..." menu item to do the merge.