M. Dhaouadi
M. Dhaouadi

Reputation: 625

push changes to a branch without merging?

Let's say I want to work on a branch, so a create one:

git branch <name_branch>

then I work on it git checkout name_branch

then I commit the changes:

$ git add .
$ git commit -m "adding a change from the feature branch" 

But I still have some work to be done on the branch, so I don't want to merge it yet, but I need to get it online, will git push branch_name do the trick? or should I merge with he master branch after each commit and then push the changes as recommended in the basic workflow?

Upvotes: 2

Views: 7665

Answers (2)

dimwittedanimal
dimwittedanimal

Reputation: 656

If it's truly a new branch like you said above, it will not merge into master.

The remote repository should create its own new branch with the changes where you can merge branches later.

Upvotes: 4

Jamie Bisotti
Jamie Bisotti

Reputation: 2685

I would not merge to master just to save my work-in-progress -- master should always be clean. With Git, branches (local and remote) are cheap. If you want to back-up your local branch to the remote, just do this (assuming your remote is named "origin" and you have <branch_name> checked out):

git push -u origin <branch_name>

Upvotes: 4

Related Questions