It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Questions about Git-Flow Release

Hi,

I am using SourceTree and Git-Flow and am wondering if someone could educate me on a few things.

1. The purpose of the Track option in the Push dialog 

As per the Git-Flow recommendation, I have two branches, Master and Develop. Whenever I am on the Develop branch and use Git-Flow to Finish a release it prompts this dialog.  

 

PushDialog1.png

The default choice for this tri-state button is always "mixed". And if I just Push it works fine. 

However, if I were to choose to push to the master at the same time the track option changes to a checkmark as below.

 

PushDialog2.png

From another post I found this information. 

Checked = Set the remote branch to be the one the local branch should track

Unchecked = Stop the local branch tracking anything

Mixed (-) = Don't change any tracking on this branch, leave it as-is

My question is why does it check it on the master? And how do I correctly push to both branches when finalizing a release? Right now I have to push to the develop. Switch to the master and then push to the master. Would setting the option to "mixed" do the same thing? It seems logical but honestly this whole git thing can be confusing as hell so I don't want to mess up my repository by doing something I shouldn't.

 

2. Generating a release with new (added) files

My second question is about generating a release with new files in the Develop branch. I dont know if this is right but whenever I do this, the release fails. I then have to go to the master and add the files and then issue the release.

I am not sure why I need to do this extra step since I need files added anyway. And quite honestly from the Git_Flow branching model (https://nvie.com/posts/a-successful-git-branching-model/) it looks like the master just holds all the latest files once the develop branch has been properly vetted. Shouldnt the files just be pushed to master branch automatically? What am I missing?

I apologize in advance if these questions seem basic but git can get very confusing at times for the uninitiated.

TIA

 

1 answer

0 votes
Mike Corsaro Atlassian Team Jun 26, 2019

Hello!

1. The purpose of the Track option in the Push dialog 

Q: "Why does it check it on the master branch"

A: When you check the box to push to the not-current-branch we assume you'd like to associate the tracking branch as well. For the current branch we already know if it's tracked, so we don't explicitly change the setting

 

Q:  "And how do I correctly push to both branches when finalizing a release?"

A: You're on the right track -- just check the box for each branch you'd like to push. You can have it mixed if you know the branch already exists on the remote and is tracked locally but we check the box just in case.

 

2. Generating a release with new (added) files

Q: "I am not sure why I need to do this extra step since I need files added anyways"

A: I'll need some more info about this -- are you getting a specific error?

Hi Mike,

Thanks for the response. Just to follow up on question #1.

"You can have it mixed if you know the branch already exists on the remote and is tracked locally but we check the box just in case."

So since I am using GitFlow which created both branches remotely and I am assuming is also tracked locally, does leaving it mixed or checked do the same thing in this case? Just want to be sure.

I guess in my mind I am confused as to is why this is even an option given the Gitflow process of releases being pushed from the develop branch to the master branch. Again sorry if this seems like a dumb question.

As for #2,

I seem to be having some weird issues with SourceTree. When I try and issue a release it sometimes but not always fails. When it does fail, it switches to the master branch and (randomly?) marks some files from my repository in the unstaged file area as deleted. Unfortunately I didnt get a screen capture of it as I was in a rush to do a release for a customer. But what I had to do is discard the deleted files form the unstaged area which luckily restores the local repository and then I have to manually finish the commit to the master. Then do the release again to close the process.

I think this happens when I do a start and end release too quickly. It appears that the delay in updating the remote seems to affect this. If I wait a few minutes between the start and end of a release then I havent seen this issue (yet). But it has happen a number of times.

I will experiment on a non-critical project and see if I can reproduce what is happening. Or if this happens again on my work project I will post the message here.

Thanks again for the response.

So since I am using GitFlow which created both branches remotely and I am assuming is also tracked locally, does leaving it mixed or checked do the same thing in this case? Just want to be sure.

If you're using GitFlow you probably don't have to worry about it. The mixed checkbox setting I believe will create the remote branch if it doesn't exist and track it (this is a git behavior BTW, we just run the default git push command). Checking the box does an explicit track command after the push. I pretty much never check that box and I've never had any issues.

 

I guess in my mind I am confused as to is why this is even an option given the Gitflow process of releases being pushed from the develop branch to the master branch. Again sorry if this seems like a dumb question.

Hey, no worries! Git is confusing, and that's the exact reason why we continue to work on Sourcetree 🙂.

That option is there because not everyone uses flow, and the push dialog isn't aware of flow either. Additionally, some users might want to push one branch to another branch that isn't set as the remote tracked branch, or they'd like to push to more than one remote. When making decisions about features we often lean on the side of more options than less due to the number of unique workflows we've seen.

 

I will experiment on a non-critical project and see if I can reproduce what is happening. Or if this happens again on my work project I will post the message here.

Excellent, thanks!

I am still having issues creating a release with new files added. Once ST tries to switch to the master it always gives some sort of error along with, randomly it seems, marking file(s) as deleted. I really am not sure what is going on here.

On running a GitFlow release this is the error I got. Please note that the file in question is ALREADY in the repository and has existed for months. I did however, make a change to it for this release.

Error.PNG

At this point, ST has switched from Release to Master and shows the following:

error3.PNG

Now in order for me to get this to work correctly, I have to DISCARD the changes to auth.js. Then I have to manually commit the changes. Then switch to Release. Complete the release. Then Push the changes on both branches.

As I noted previously I thought this might be related to completing a release too quickly but I waited a good half hour before completing the release. 

So I am not sure why this this happening and what I can do about it. Any ideas why? Am I missing something in the procedure?

 

Thanks,

Khalil

Mike Corsaro Atlassian Team Jul 09, 2019

Hmmm... I don't think the timing has anything to do with it. I suspect the error line with "permission denied" is probably the culprit.

 

Is there anything that might have the file open that could be preventing file access? As a work-around could you try running the command "git flow finish release TAG_NAME_HERE" from the terminal (just click the terminal and see if you get the same error?

 

Thanks!

'error: unable to create file...Permission denied'

I noticed that myself but it doesn't make any sense to me as the file has already been created. Wouldn't it just log the changes?

Regardless to answer your question, I use VS Code for development and all those files are part of the repository. So I would assume that I would get a permission denied for each file that I am trying to push. And that file wasn't even open at the time.

As I said before it appears to be random. The thing is I have two repositories that seem to have this issue but not all the time. As a side note, I did notice at one time my origin/develop head seemed to have disappeared from the repository. Then sometime later it reappeared.

I realize that this random information does not help to narrow the situation but I am just trying to recall when this started because things were all good then all of a sudden either one or the other of the repositories has this issue at any given moment. 

In both cases I have tried to pay more attention to the cause and according to my notes, it seems to fail when I try to issue a release with new files added to the repository. But I can't be 100% sure yet that this is the only cause because it seems so random.

As for the command, I will try that on my next release and report back.

I will also try pushing both branches at the same time on another release. I am am just concerned about it deleting files on me. So I will back up before the completion.

Thanks again for taking the time to answer. I really appreciate it.

Khalil

Just a follow up question, is there a command to test the integrity of the repository?

So I tried the command as you indicated. Just in case anyone else is reading this, the command should be 'git flow release finish TAG'.

After asking me to make comments in VS Code, it appeared to merge correctly. After it was finished I pushed the changed to both the master and develop at the same time with no issues.

The full summary is below:

---------------------------------------------------------

$ git flow release finish 000.025
Switched to branch 'master'
Your branch is up to date with 'origin/master'.
hint: Waiting for your editor to close the file...
Merge made by the 'recursive' strategy.
src/main.js | 2 +-
src/packages/deal-status.js | 4 +-
src/views/Common/Section/Deals/Status/Status.vue | 79 +++-------------------
.../Common/Section/Deals/Status/StatusLawyer.vue | 15 ++--
4 files changed, 19 insertions(+), 81 deletions(-)
Already on 'master'
Your branch is ahead of 'origin/master' by 4 commits.
(use "git push" to publish your local commits)
hint: Waiting for your editor to close the file...
Switched to branch 'develop'
Your branch is up to date with 'origin/develop'.
Already up to date!
hint: Waiting for your editor to close the file...
Merge made by the 'recursive' strategy.
Deleted branch release/000.025 (was 04df161).

Summary of actions:
- Release branch 'release/000.025' has been merged into 'master'
- The release was tagged 'Rev000.025'
- Release tag 'Rev000.025' has been back-merged into 'develop'
- Release branch 'release/000.025' has been locally deleted
- You are now on branch 'develop'

---------------------------------------------------------

Again, while command-line worked I cannot say with confidence that ST would or wouldn't have worked.

Now my question is what does this mean? :) 

Thanks,

Khalil 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,962 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you