Git: is in the middle of writing the function of the company, how to continue development at home without submitting it?

problem description

in the middle of writing, obsessive-compulsive disorder does not want to have a spam submission, such as git commit-m "write halfway home to write" .

method tried:

starts using the git stash command, but you can only temporarily save the code locally, and you can"t go home and pull the half-written code.

is there any way to go home and continue to develop half-written features without garbage submission?

Git
Oct.25,2021

  1. the first way: still use git commit . After the development is completed, git rebase-I [commitID] , merge the junk commit, so that there will be no garbage submission;
  2. the second way: still use git commit . When the development is complete, git reset-- mixed [commitID] will roll back your commit, but your workspace code will not change. You can re- git add [files you need] and git commit to reorganize your commit, so that there will be no garbage submissions;
  3. third way: you don't need to use git commit . When in the company, git diff > [patch file] , send it to Wechat, return home, git apply [patch file] , continue development, complete the development; repeat the initial steps, generate the patch file, send it to Wechat, download it when you arrive at the company, and continue git apply [patch file] .

Why bother to submit on your own branch? it doesn't matter if it doesn't affect the main branch.


sourcetree take a look. The graphical interface operation may have


submitted to the temporary branch, and delete


    after use.
  1. git stash
  2. git create a new branch, such as go home to develop
  3. git stash pop
  4. git push
  5. go home
  6. git pull
  7. develop
  8. commit
  9. merge branches and push
  10. call it a day

my plan:

in the company:

git commit -a -m 'tmp'  -sharp -m
git push

go home:

git pull
-sharp 
git commit -a --amend -m ''  -sharp -m
git push -f

if there are too many trash submissions in the middle, think of a merge. Then you don't have to use -- amend , which is equivalent to reset head ^ + commit

.

you can first use git log to see which submission to roll back to, and then git reset a1b2c3 , git add-A , git commit-m 'coquettish code' , git push-f .

pay special attention to : because you have used git push-f to forcibly overwrite the remote warehouse at home, it will lead to different branch trees in your company's git warehouse, so using git pull in the company will prompt code conflicts, so you need to use git fetch , git reset-- hard origin/master to force Synchronize local warehouse. The name of the branch should be changed according to the actual situation of its own place.

try teamviewer? Remote is very smooth, home mobile, company telecom


take the computer home, not ok!


Why are you working at home


copy the code home


is there any problem with submitting it this way? Rebase.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e49039-44d08.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e49039-44d08.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?