0

I need to save on the cloud the source code, but i have not finish my feature, i am using gitflow, but I have did local commit.

git commit .

git push ?

is that possible?

DDave
  • 1,400
  • 3
  • 16
  • 33
  • 1
    First of all, it is entirely possible to commit *whatever* and push that into your upstream. The question is what kind of impact this will have. Are you pushing to master? That is, *straight to production*? You should probably do this only on feature branches. Additionally, even with a feature branch, doing this will likely generate many small commits that have a focus on "commiting for Thursday 25th" instead of "implementing feature X", and this will create a noisy and polluted project history. You might look into rebase/squash for this. Your best option, however, is to ask your architect. – Lasse V. Karlsen Oct 25 '18 at 13:38
  • I think the question you might need to answer is **why** you feel the need to "save on the cloud" unfinished work. – Lasse V. Karlsen Oct 25 '18 at 13:40
  • Also note that I'm not advocating working for a week between commits either, but you should split your work into chunks of meaningful changes and commit those. Even if the whole feature is not yet done, the work you commit should be done by itself. You should still do this on a feature branch and you might still want to look into rebase/squash to get some of the noise down. Try to avoid committing just because you're *going home for the day*, instead try to focus on committing because you're *done for the day*. – Lasse V. Karlsen Oct 25 '18 at 13:42

1 Answers1

0

Yup, that's the reason why git is made. You can save your source code even if you have not finished the feature. Assuming you are on a feature branch. First add all the file using:

git add .

Then write an appropriate msg like for your own convenience :

git commit -m "Feature xxx part 1 completed, part 2 remaining"

Then just push:

git push
waterbyte
  • 241
  • 1
  • 16
  • have you idea como delete a feature that i've created, but i made i mistake i've commit directly on the develop branche – DDave Oct 25 '18 at 14:08
  • 1
    @DDave Check this : https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-commits-in-git?rq=1 – waterbyte Oct 25 '18 at 14:12