Pregunta

If I commit but not push my changes with GIT (we're also using github) is my work saved outside of my machine?

For various reasons I wont go into its best that I dont push my changes for a while and im wondering if all my work is being saved anywhere outside of my local computer? It seems quite high risk if if isnt.

¿Fue útil?

Solución

Either make regular backups of your .git directory, or create a 2nd clone on another machine, add that as another remote repository to your repo, and push to it periodically.

Otros consejos

No. The purpose of a commit is to make a bookmark in your code changes, in case you want or need to retrace your steps or find the introduction of an error. Committing does not move your code to a remote repository. You need to push to do that.

You can, however, branch off of your master branch and push/pull this branch so you don't end up stepping on any toes. Once you are happy with your changes, you can merge your branch into master.

> git branch

* master

> git checkout -b foo

### make commits ###

> git push -u origin foo 

Now you can pull from that branch anytime.

> git pull origin foo

No. Making a commit is only local.

What to do about it depends on your reason for not pushing. If the problem is that your work may conflict with what other developers are doing, then the normal solution is to make a new branch and push that. When your work is ready to be integrated with other developers, you can merge your branch.

If you don't want your work to be seen by others at all, consider creating a private repository on a service like GitHub or Bit Bucket. Then you can have an offsite backup which is personal to you.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top