Transfer code from one computer to another via Git

I have some code I have not committed nor pushed to the branch I am working on on a local computer because the code is not working yet. However, I simply want to move that code from one computer to another without affecting the branch. How would I do so? For example, my code is on computer A, and I am working off of a branch called ‘develop’ which I pull and update code from. I don’t want to change anything in develop but I want to move the code I have written to computer B. How would I do so? If anyone could help that’d be great. Thanks!

  • How can I start a clean branch with no ancestry, then commit files progressively?
  • Why do I have to “git push --set-upstream origin <branch>”?
  • git root branches… how do they work?
  • How to make individual pull requests vs “stacking” them on top of each other in Github?
  • committing to the same branch with git
  • Git: Can I commit my working directory to a new branch without committing it to a current branch?
  • Update all git repos in a folder in windows
  • Git status shows a weird string as an untracked file
  • Unable to track files within Git submodules
  • Local and production versions of php and mysql using git
  • how to make git difftool to always export absolute paths
  • How to fix “address space is already occupied” error on fetch/commit?
  • 2 Solutions collect form web for “Transfer code from one computer to another via Git”

    I would create a new branch and push it to that branch.

    git branch incomplete-code
    git checkout incomplete-code
    git commit -a
    git push origin incomplete-code
    

    You can then clone the repo on your own computer and work on the incomplete-code branch

    git clone <repo address>
    git checkout incomplete-code
    

    After your code is complete, you can merge the branch as such

    git checkout develop
    git merge incomplete-code
    

    There might be various ways to do it but this is one I can think of.

    In order to do the transfer using git you must commit the changes to the local repo on computer A. If you don’t want to do that then you should simply copy the changed files from computer A to computer B outside of git.

    If both computers have access to a central git repository you can do as others suggest and commit the code to a new branch on computer A, push the new branch up to the central repo, and then pull the new branch down onto computer B.

    If computer B is capable of pulling directly from computer A then you can commit the code to a new branch (or even to the existing ‘develop’ branch on computer A, just don’t push that commit to any pubic repo) and then on computer B pull that commit directly from computer A.

    If the computers are not connected except through a sneakernet you can use git bundles to transfer the committed code from computer A to computer B.

    You can also commit the code on computer A, use git format-patch to create a patch file, copy the patch to computer B, and use git apply to apply the patch.

    Git Baby is a git and github fan, let's start git clone.