Reputation: 2773
I've been using Git for version control and GitHub for publishing code for a little while now. I'm getting comfortable with the interface and find it very helpful. However, I'm a bit torn with this situation. I'm a student using my school computers and personal computer to write code.
I have to frequently work on my application from multiple computers. I could be in the middle of writing code when the period ends and I need to leave. It feels wrong to push the code up to GitHub then sync the remote branch with my PC when I get home (this means that'd I'd have daily pushes to GitHub.) However, is this correct usage? If not, what tool should I use? I want to sync multiple workspaces together with code that could very well be incorrect and buggy.
Upvotes: 1
Views: 142
Reputation: 4112
I would recommend the following ,
Create a branch called school_work
and work on that. At the end of the day pushout your changes to develop
.
Remember we will be using develop
as the branch that has the holy
code.
When you reach home checkout the school_work
branch and continue where you left off.
At the end of the work.
Do a git rebase -i ...
to do a interactive revase wherein you organize your commits the way you want them to look like.
At the end do a git pull --rebase origin develop
. This will rebase your branch against develop.
Now merge your school_work
branch into develop
.
At the next school work session checkout a new branch called school_work2
from the then develop
and repeat the steps.
Upvotes: 0
Reputation: 2211
It's ok to push as soon as you target a work in progress branch.
Later on you can ammend or squash the history of that branch before merging with other main branches.
Take a look at this: https://git-scm.com/book/es/v2/Git-Tools-Rewriting-History
Upvotes: 1