omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    StaSh and Git Cmd problems

    Pythonista
    git stash
    3
    15
    9074
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Phuket2
      Phuket2 last edited by Phuket2

      I am having problems with StaSh and git cmds. I don't want to waste anyone's time, so i guess the first question is can I rely on StaSh git functions, clone, push, pull? If not, I guess no need to read further. I realise that StaSh is using other Libs for git.

      My workflow:

      1. created a repository on Github called lords_project (public repo)
      2. In StaSh, did git clone (URL + .git)
        -Everything thing seemed to work ok except the folder name created in Pythonista was called 'lords_projec', it was missing the 't' at the end. But the readme and licence file was in the directory.
      3. in Pythonista , I created new file in the directory called program.py
      4. in StaSh in the lords_projec dir , I did a git commit on program.py
        -seem to work ok.
      5. Then i did a git push.
        -It says it was successful, but no file turns up in Github. I am sure it's not there , did many refreshes.
      • so for whatever reason push not working for me
      1. added a new file to the repo in Github web client.
      2. in StaSh, did a pull.
        -first time it did not seem to work.
        -so I restarted Pythonista, and did the pull in StaSh again. the file I created in Github turned up

      So, the fact the folder name got changed seems a bit strange, but as things mostly seemed to work, I kept going. Maybe, I am using bad naming conventions.

      I felt I had finally got the workflow correct as I went through these steps on another repo using PyCharm. using the GUI, but I thought I was starting to finally understand the simplest workflow case.

      If this can work, I would love to be able to use it Rather than using working copy or workflow for example. seems, if you can get your head around these git comes in StaSh, this would be the most forward way of using git with Pythonista.

      Below, just an output when I did the pull and the push. pull worked, push didn't .

      StaSh v0.6.19
      Tip: Show a random tip with command totd
      [~/Documents]$ cd MyDeployments
      [MyDeployments]$ cd lords_projec
      [lords_projec]$ ls
      LICENSE README.md program.py
      [lords_projec]$ git pull
      [lords_projec]$ ls
      Created_in_git.py LICENSE README.md program.py
      [lords_projec]$ git push
      Attempting to push to: https://github.com/Phuket2/lords_project.git, branch: refs/heads/master
      Push to https://Phuket2:*******@github.com/Phuket2/lords_project.git successful.

      success!
      [lords_projec]$

      edit
      I guess this an implementation thing but unlike other terminals, when you enter a dir that is git controlled you normally see the prompt change to include the branch that you are on. StaSh, does not do this

      1 Reply Last reply Reply Quote 0
      • mikael
        mikael last edited by

        For what it is worth, I use the flow you described, and have used it for many repositories successfully. I have not run into problems like the ones you described.

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          I am not quite sure I see the issue... maybe it is a question of the branch you are on?

          I think I started a pythonista stash git tutorial on my github repo a while back. that might be a good place to get started with this limited flavor of git.

          Phuket2 2 Replies Last reply Reply Quote 1
          • Phuket2
            Phuket2 @JonB last edited by

            @JonB, yeah!!!!!!!!!!!!
            Thanks a lot. I was missing the git add in my workflow, push is working now. Well it was always working, it was pushing what it knew about. PyCharm also has the add, but i sort of missed it, as it appears its outside the workflow, but now I understand its not.

            I also seen in your tutorial you pass the name of the dir you want for the cloned repo, I hadn't done that. I will try that later, I am guessing that will fix the naming of my dir for the cloned project folder.

            Honestly, thanks again. I know I have tried to get my head around using git before and failed. This time I am determined to get it all working. If I want to do anything half serious with PythonAnywhere or similar services I really don't have a choice.

            But I am getting there now, slowly.

            1 Reply Last reply Reply Quote 0
            • Phuket2
              Phuket2 @JonB last edited by

              @JonB , just side note. I just did a simple search and found this link for doing bash jupyter notebooks. I know there are not enough hours in the day as it is. But someone reading here might get inspired. I assume that with a bash kernel or whatever you call it, you could do your tutorial in the notebook and it would be like doing it StaSh.

              I just discovered today PyCharm has a built in Jupyter Notebook editor built into the GUI :( . I have launched it from the terminal before into the web browser.
              I have been going at a snails pace learning. Oh, well. It's still fun

              1 Reply Last reply Reply Quote 0
              • Phuket2
                Phuket2 last edited by

                For anyone reading, I found out git add . (Dot), Does not add everything in the dir, an error is created. from what I read I think it's suppose to. But wildcards work, i.e git add *.py or git add . both work.
                git commit . , appears to commit everything in the directory.

                1 Reply Last reply Reply Quote 0
                • mikael
                  mikael last edited by

                  I have this simple alias in .stashrc. It adds, commits and pushes all modified files.

                  alias gup='git add `git modified`; git commit; git push'
                  
                  Phuket2 2 Replies Last reply Reply Quote 1
                  • Phuket2
                    Phuket2 @mikael last edited by

                    @mikael , not sure why, but your alias did work for me. But fantastic to know about the alias cmd...
                    I did - alias guppie='clear; git add (star.star) ; git status; git commit . ; git push'
                    And it works as I expected it to. I could not work out how to escape the asterisk:(

                    The output from when I run up is below. Hmmm, however as I was writing this it dawned on me it's different. You are adding modified, I am adding all were you are adding modified. So if I rung up and there is a modified file it does work. If there is nothing modified only new files, you get the msg below.
                    But thanks, it's been super helpful

                    [lords_project]$ gup
                    Adding
                    stash: <type 'exceptions.IOError'>: [Errno 21] Is a directory: '/private/var/mobile/Containers/Shared/AppGroup/3533032E-E336-4C25-BBC4-112A6BF2AF75/Pythonista3/Documents/MyDeployments/lords_project/'

                    Commit Message:
                    1a519e20424aedc23e01b46e7014bb7d45785f2a
                    Attempting to push to: https://github.com/Phuket2/lords_project.git, branch: refs/heads/master
                    Push to https://Phuket2:*******@github.com/Phuket2/lords_project.git successful.

                    success!
                    [lords_project]$

                    1 Reply Last reply Reply Quote 0
                    • Phuket2
                      Phuket2 @mikael last edited by

                      @mikael , do you know about .jpg files being in a repo. .jpg files seems to screw things up. When I run my guppie cmd with a .jpg in the dir I get the below. I am guessing binary data can not be sent

                      Adding Created_in_git.py
                      Adding IMG_1470.PNG
                      Adding README.md
                      Adding junk.py
                      Adding mypyuifile.pyui
                      Adding program.py
                      Adding test1.py
                      Adding test2.py
                      Adding test3.py
                      Adding test4.py
                      STAGED
                      add['IMG_1470.PNG']
                      UNSTAGED LOCAL MODS
                      []
                      f9bc619d876e6ab9e206ad3e565e6c2851677a28
                      Attempting to push to: https://github.com/Phuket2/lords_project.git, branch: refs/heads/master
                      stash: <class 'urllib2.URLError'>: <urlopen error [Errno 32] Broken pipe>

                      [lords_project]$

                      mikael 1 Reply Last reply Reply Quote 0
                      • mikael
                        mikael @Phuket2 last edited by

                        @Phuket2, see this.

                        Phuket2 2 Replies Last reply Reply Quote 1
                        • Phuket2
                          Phuket2 @mikael last edited by

                          @mikael , thanks. Yeah, I get exactly same as you. Can not recover. I tried git reset --hard etc. nothing seems to work to get it back in shape. Looks like it's still unresolved.
                          But really, I am very happy with what I have managed to get working so far with your guys help. It's a miracle for me :) black magic. I will just avoid bin files for the moment. If I do need one, I will try to add it another way and pull it down (hopefully)
                          Thanks again

                          1 Reply Last reply Reply Quote 0
                          • Phuket2
                            Phuket2 @mikael last edited by

                            @mikael , just to let you know. I uploaded a .jpg file into the repo with Github web client. The pull from StaSh was successful.

                            mikael 1 Reply Last reply Reply Quote 0
                            • mikael
                              mikael @Phuket2 last edited by

                              @Phuket2, yes, that works. However, working from an iPhone, I have yet to find the place where you can rename the uploaded file in the Github web interface.

                              Phuket2 1 Reply Last reply Reply Quote 0
                              • Phuket2
                                Phuket2 @mikael last edited by

                                @mikael , on my ipad I could also not see a way to rename it in the. Web interface. I cloned the repo in working copy. I could rename it there.
                                Then I did a pull in StaSh and ended up with a new image file and the old one was still in my Pythonista dir. Maybe I should have used merge or something, I am not sure

                                1 Reply Last reply Reply Quote 0
                                • JonB
                                  JonB last edited by ccc

                                  iirc the stash git tutorial had a review of how to use ssh-keygen, and then how to upload to git. Then you can use git remote to add a link to the ssh://git@github.com/tourname/yourrepo.git url, (i usually name it sshorigin) then git push sshorigin should work. I think there is a size limit for the https in dulwich.

                                  1 Reply Last reply Reply Quote 0
                                  • First post
                                    Last post
                                  Powered by NodeBB Forums | Contributors