MukMuk
MukMuk

Reputation: 166

Git merge branchX into master. Delete branchX and start fresh new branchX?

I use git for a website. So at first I started with master, created develop and worked in it. The website is finished by now. I merged develop into master and tagged it with v1.0.

What about the 'develop'-branch? Do I work just as usual, or should i delete develop, clone it from master and start with a fresh develop-branch?

And, if I work as usual and merge later, like for a release-1.1, does git merge old commits again? It shouldn't, because of the same SHA-keys...?

Upvotes: 0

Views: 64

Answers (3)

lonelyelk
lonelyelk

Reputation: 578

After merge develop and master point at the same commit. There is no need to delete and rebranch.

Upvotes: 0

Manolo
Manolo

Reputation: 26440

I'm working with a git remote repository and two local repositories: localhost for development and VPS for production.

I think the best way is what you say: remove your develop repository and clone from the remote one. On the other hand, you can use .gitignore files to avoid changing files that you don't want to change.

When you have all done, you can develop in your local repository, then, after commit, you can push the changes:

git push -u original

Now, you can get into your server via ssh and:

 cd /var/www/yoursite
 git pull

And that's all. You have your changes in all your repos.

Upvotes: 0

mikedugan
mikedugan

Reputation: 2393

You should just keep working in develop. Deleting and re-branching from master won't solve anything for you - you'll get the same thing you did when you merged into master.

The exception to this would be if you other branches that you were merging to master (bug fixes, feature dev, etc). In this case, you would either need to pull again from master, or (preferably) merge other branches into develop and use it as a catch-all for anything going to master.

In an exclusively 2-branch setup, just keep working in your develop branch :)

Upvotes: 1

Related Questions