Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git pushing unfinished changes to repo

Tags:

git

repository

Another Git question if someone wouldn't mind answering:

I develop websites on a desktop from within the office, and on a laptop when I'm working from home, both storing files on their local drives and tracked using an online Git repository.

When I create a new feature from the laptop at home, what would be be the best way to get these changes over to the desktop - would I stage the changes, create a commit for them and then push them to the online repo even though the feature is still incomplete, or is there a better way?

I'm really not sure if creating a new commit on the feature branch just to push the changes to the repo just so that I can fetch the changes when I'm in the office is the correct way, but perhaps I'm wrong...?

like image 998
Goonyan Harir Avatar asked Oct 03 '22 16:10

Goonyan Harir


1 Answers

You should be using a new branch any time you are creating a new feature or fixing a bug - which you may already be doing.

I would just commit your changes on the local feature branch and push changes to your remote feature branch and then pull them down on your other machine, there is no problem with this...

If you want to tidy up your commits before you merge them into master then you can squash them ... see this question: Squash my last X commits together using Git

like image 198
Matt Cooper Avatar answered Oct 12 '22 12:10

Matt Cooper