Can you leave a commit only local?

Asked

Viewed 221 times

0

The question may be kind of obvious or even confusing. But what I want to know is if there’s a way to leave a commit only local, for example. I’m working on a feature and such, did some important commits, but suddenly comes an urgent demand, which I need to complete and send to the server. How do I send only what was requested(As if I chose the commits to be sent and left the ones I was working on before).

I’m starting with git.

  • 2

    Every commit is local until you push, your problem can be solved with branches, as Ailton suggests, but it would be interesting to take a look at git book

2 answers

7


The ideal is to separate the development of new functionalities by branches. That way, you avoid this kind of problem.

A methodology for development across different branches is the Git Flow:

  • 1

    Very good. That’s what I wanted.

1

I use the following strategy! I create a new branch based on my development branch called "Partial" I eat everything in it that I won’t add to that commit. I do the "Officers" committees in the development branch.

When I feel comfortable going back to that line of thought, I merge with my current state.

However, strongly recomentadia creating a branch by functionality, at first it may seem confusing, but garato that is very advantageous. To decrease the mess a little, you can create Branches folders, example:

Products/purchase
Products/sale
Users/testes_unitarios
Usuarios/Cruds
Usuarios/Auutenticacao

just put this "/" between the folder name and the branch name

  • Thanks. Really this organization helps a lot. I’ll try to study it there.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.