Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I have a branch feature/xyz-functionality which I wanted to merge with develop branch. I created 3 days ago and I don't have rights for merging.

On the other hand my team lead is busy in other stuff, and in this period I wrote more script which I need push it, since I created merge request I am afraid to push commit on it.

So what is the good practice, I should push commit on it? Can I? or I should create new branch and then push it?

Kindly guide me about it, I would really appreciate. Thank you so much.

like image 537
Imran Abbas Avatar asked Sep 22 '19 06:09

Imran Abbas


People also ask

Can I commit to a merged branch?

Merge branchesMerging your branch into master is the most common way to do this. Git creates a new commit (M) that is referred to as a merge commit that results from combining the changes from your feature branch and master from the point where the two branches diverged.

Can you commit to a branch after pull request?

You can commit changes on a pull request branch that was created from a fork of your repository with permission from the pull request creator. You can only make commits on pull request branches that: are opened in a repository that you have push access to and that were created from a fork of that repository.

Can I update a merge request?

If you need to update a merge request (for example in response to a request from the review shifter), simply push to the same branch again after editing (and testing) the files.

Should I commit before merging?

Ideally, you'd like it to be clean before you attempt to merge in remote changes (remember, git pull = git fetch + git merge ). git commit is one way of accomplishing this, but it will alter your history--thereby polluting it if you're concerned about leaving your repo in a constantly working state.


2 Answers

You can push commits to the same branch and they will get added to the pull request you have already open. For the question is it good practice, it really depends on your organization...

like image 70
vale Avatar answered Sep 22 '22 00:09

vale


You can commit and push to the same branch as well create a new branch.

I would prefer to push to the same branch(if not merged yet) if the changes are for the same story and create a new branch if they are for a different story.

like image 21
Sagar Chaudhary Avatar answered Sep 20 '22 00:09

Sagar Chaudhary