Hannes
Hannes

Reputation: 5262

Working on two different devices / not polluting repo

I am the maintainer of an open source project hosted on GitHub (public repository).

Due to my current working pattern, I have to work on more than one device on the source code. That leads to situations where I have to switch between two devices in order to continue coding.

Back when I had a private repository I would just commit to the develop branch (or any feature branch for that matter) and pushed to origin on one device and pulled/rebased on the other one. No meaningful commit message, no build-able status on some occasions.

Now, working on a public repository I do not want to 'pollute' the branches so I wonder: What would be the best course of operation?

Is there anyone having good advice for me?

Upvotes: 0

Views: 66

Answers (2)

ymonad
ymonad

Reputation: 12100

If you can create private GitHub repository:

Setup

  1. Create new private GitHub repository e.g. example/example-private
  2. In your local repository, which cloned from public repository, add new remote origin:
$ git remote add origin-private https://github.com/example/example-private.git
  1. Push all the local repository to private repository:
$ git push origin-private

Develop with private repository.

  1. Create private branch:
$ git checkout -b develop-private
  1. Push to private repository:
$ git push -u origin-private develop-private`

Now you can share develop-private with multiple devices via private repository.

When development in private is done

  1. merge or rebase develop-private branch with your public develop branch.
  2. push it to public develop branch

Upvotes: 2

dunajski
dunajski

Reputation: 389

So the problem is, you don't want to commit your undone work for example. If I were on your situation I would do this in this way.

  1. git add .
  2. git commit -m "work in progress, don't checkout from this commit

And when you are on another device, after downloading changes that you did on first device. I'll do.

  1. git reset --soft HEAD~1

And in that way you have your work on another device and public repository is free of useless commit.

Upvotes: 0

Related Questions