Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we commit on branch that's already been merged with master?

I have a branch, say "XYZ", I worked and did a few commits on that branch and later merged it with my master branch. Now, I want to do some more changes in my code and want to use that same branch. I have not deleted the branch.

Can I use the same branch again? Can I then merge the new commits with master again? Or is the only solution to create another branch?

like image 982
ihaider Avatar asked Feb 13 '14 10:02

ihaider


People also ask

Can you commit to an already merged branch?

You can continue working on your branch and then when you merge with master again, it will bring the commits that are missing on master.

Can I still add commit on branch after created merge request?

Yes you can being on a new branch doesn't stop you from using a commit.

Can we commit to merged branch git?

In the event that you require a merge commit during a fast forward merge for record keeping purposes you can execute git merge with the --no-ff option. This command merges the specified branch into the current branch, but always generates a merge commit (even if it was a fast-forward merge).

What happens to the branch after merging to master?

The answer is: nothing happens to the feature branch as a result of the merge.


1 Answers

You can still work on that branch as it still exists.

The git-merge documentation says:

Incorporates changes from the named commits (since the time their histories diverged from the current branch) into the current branch.

You can continue working on your branch and then when you merge with master again, it will bring the commits that are missing on master.

like image 174
maclir Avatar answered Sep 27 '22 17:09

maclir