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.
Gists Vrs Repos for sharing Pythonista code
-
I was reading about Gists, and the docs say that they are functionally equivalent to repos, in regards to cloning, forking etc...
@ccc, I noticed you had a post before about Gists being unmanaged. Have they changed since you wrote that? Or are Gists inferior to repos. From what I read, a gist is a repo.
I understand this is not Pythonista specific, but just trying to work out the best way to go. As Pythonista has some support for Gists, it would make sense to use them if they are functionally equivalent.
-
My sense of things is that with Gists, I can send the author comments about their code. With Repos, I can do everything that I can do with a Gist but I can also send code corrections/additions that the author chan chose to integrate in (or ignore).
To me, Gist is about advertising code while Repo is on collaborating about code. My knowledge may be (is!) incomplete.
-
Ok, I will keep looking. I got the impression you could do the same. But, and a big but, I need to read further. Is still black magic for me. Well, not entirely, i get the gist of things ;) but the source code management tools I used a long time were no where near as sophisticated what they are now. Being on the iPad adds that little extra, holy crap!
-
Gist does alow forking, but there's no way to get the fork merged back into the original Gist, because the entire issue/PR features are missing. (Gists also have horrible URLs. Compare https://gist.github.com/omz/05f096319c23c4addba9 and https://github.com/omz/AppSales-Mobile - which one has the obviously cleaner URL?)
-
@dgelessus, thanks for clearing it up. Not that I am even close to be able to collaborate on a project yet. But with some luck and hard work, I will be able to one day. So I will keep trying to get my head around it. I personally find the interface on github a mine field. But I am not used to it. Starting to follow some of their tutorials, so hopefully I will get the hang of it sooner or later.
Thanks again. -
GitHub can be confusing... There are a lot of utilities in Pythonista-Tools to help but it can still be complicated.
I was recently asked to document how I create Pull Requests into GitHub repositories that I do not own. I have trouble remembering all the magic syntax of the git command line tools in StaSH or on the Mac OSX command line. I tend to like using GUI tools more.
You can just use the GitHub web pages and copy and paste your changes in place and create a Pull Request that way but this can be confusing and gets quickly painful if you want to touch a number of files in a single pull request.
Another simplifying approach is to use PyCharm Community Edition but this too can sometimes be more complicated than it should be.
I wrote https://github.com/cclauss/GitHub-web-plus-app-workflow as a step-by-step description of how I use a web browser and the GitHub Desktop app on Mac or Windows to fork, save local, edit, commit, and create a pull request on a repo that you do not have write access to.
If you are so inclined, please give it a try and open an issue if you see where improvements can be made.
-
@ccc, I am almost never on my desktop. Did you write the guide with a desktop as part of the work process because it sort of has to be?
I would love a process to do everything from my ipad. I am not sure if that's unrealistic or not. I see people doing all sorts of things with workflow and workingcopy. But for simple old me it seems so convoluted. It really does frustrate me. There are so many talented programmers here, I feel this should be a no brainer.
But it gets to the root of what is being addressed here. Repos and cooperation. If all you smart guys got together and worked on one tool to give the whole create/edit/test/update etc.. Cycle inside Pythonista, I am sure it could be done.
2 second thought about 1 senerio ....
-
As far as I know you can do all the important things with the
git
commands in stash. The most important ones you need to know are:git clone https://github.com/username/reponame.git
to download a repo's contents into the current folder, so do it in a new empty folder or have fun cleaning up the mess afterwards.git pull
to update an existing repo to the version available on GitHub. (You don't need to specify the URL here, because it's already stored in the.git
metadata folder.)git status
to see which files have changed locally, and which modifications will happen in the next commit (see below).git add
andgit rm
to add or remove a file from the next commit.git reset
to undo any changes since the last commit.git commit
to save the changes in the repo as a new commit. When you run the command, you'll be asked to enter a commit message, where you should write a short one-line description of the changes you made. (On a real computer you can write a more detailed description in multiple lines, no idea if that's possible in stash.) The first time you commit to a repo (after you've cloned it) you're also asked to enter your username and e-mail address, which should be the same that you use on GitHub.git push
to publish any local commits to GitHub. The first time you do this you're asked to enter your GitHub username and password. Obviously this step only works for repos that you have write access to.
Also see this very short guide to Git.
-
Did you write the guide with a desktop as part of the work process because it sort of has to be?
I used the GitHub Desktop app only because I never got a complete answer to https://forum.omz-software.com/topic/2382/git-or-gist-workflow-for-pythonista/2
If someone can create an alternative version of https://github.com/cclauss/GitHub-web-plus-app-workflow that uses Working Copy app instead of GitHub Desktop, that would be great.
@dgelessus With my method, I found that I had to fork instead of clone but perhaps that is rendered unnecessary by your
git pull
command.EDIT: 'When you are cloning a GitHub repo on your local workstation, you cannot contribute back to the upstream repo unless you are explicitly declared as "contributor".' From: http://stackoverflow.com/questions/6286571/are-git-forks-actually-git-clones
-
@dgelessus and @ccc , wouldn't you say the smartest thing would be for the top notch programmers come together and create a simple to use app using the the Pythonista ui libs. Something as close to fool proof as you can get.
I understand cmd line interfaces are very powerful. But this subject is at the core. I am sure I am not the only guy that can not make heads or tails of this, even when it's spoon fed to me.
I am not trying to be difficult, but Github with a user interface is difficult anyway, let alone a series of cmd line operations. For me, I cross my fingers and hopes it works out.But again I will be blunt with you guys. I think you don't get how difficult it is, just because you know it like the back of your hand. And if you struggle occasionally, imagine how the rest of us fair? Not so good!
Really, if I had the skills. The backup/restore issue would be the first thing I would tackle, this would be the second. But not by myself, need to get a consensus that this is the tool for backups, and this is the tool for Github. Others not supported. Some lines need to be drawn in the sand sometimes. I think this is one of those times.
Well, that's my idea anyway. I know how structured you guys are in your business life, I don't see this should be different.
-
@Phuket2 I might eventually decide to work on some kind of code-sharing app built just for Pythonista, as I think it'd be worth doing.
It'd be a script that automated uploading / downloading code to and from a database. The database would probably be a GitHub repo, but the script would provide a foolproof front-end.
It'd have to be a bit more complicated than that, though, because I wouldn't want to give people write access to the repo just by reading through the script's code. The way I'd do this would probably be to have a web service on my server that took requests and posted content on GitHub. This way, I wouldn't have to include the password to the GitHub repo in the script that I had people download. The web service would only provide methods for uploading new scripts and for downloading scripts, not for editing, that way nobody would be able to undo others' work besides myself.
-
I'm not actually sure how to store a password inside the web app such that it can't be accessed publicly. I've asked on security.stackexchange.com to see if anyone knows.
-
Here is a howto clone your own repo, change a file and push it back with stash.
[~/Documents]$ mkdir Github
[~/Documents]$ cd Github
[Github]$ mkdir ui-tutorial
[Github]$ cd ui-tutorial[ui-tutorial]$ git clone https://github.com/humberry/ui-tutorial.git
[ui-tutorial]$ ll
.git (374.0B) 2016-02-16 21:27:36
...
MiniPhotoView.py (3.4K) 2016-02-16 21:28:55
...[ui-tutorial]$ edit MiniPhotoView.py
[ui-tutorial]$ git status
STAGED
UNSTAGED LOCAL MODS
['MiniPhotoView.py'][ui-tutorial]$ git add MiniPhotoView.py
Adding MiniPhotoView.py[ui-tutorial]$ git commit
Commit Message: remove touch and layout method
Author Name: myusername
Save this setting? [y/n]y
Author Email:
Save this setting? [y/n]y
shi9vrz3tv5hf...[ui-tutorial]$ git push
Attempting to push to: https://github.com/humberry/ui-tutorial.git, branch: refs/heads/masterEnter username: myusername
Enter password: mysecretpassword
Push to https://myusername:mysecretpassword@github.com/humberry/ui-tutorial.git successful.
success! -
@ccc The commands I listed are for working with a repo that you own or have write access for. I'm not sure if GitHub forking is possible from the command line, there seems to be a lot of GitHub-specific stuff involved with the process. (Honestly I don't know how one would fork a repo independent of GitHub, or if that really just involves making a copy of the repo.)
-
Guys.... Dealing with a repo that you own is child's play.
GitHub's examples explain the entire workflow of dealing with your own repo in an easy to understand way. You have full read/write permissions so you can just Push changes directly into the repo without even needing to resort to Pull Requests.
The complexities for me come when I want to send a Pull Request into a repo that I do not own and I am not a "contributor" to. That is why the bold text in my post above is: create Pull Requests into GitHub repositories that I do not own.
I would still really like to see someone replicate my approach above using Working Copy app in place of GitHub Desktop.
-
@ccc GitHub specific functions can be accessed through GitHub API v3, including fork, create pull request etc. It should be possible to write a command line tool for them. But it is so convenient already to just do them via the webpages. It seems to me that the API is really for people who develope apps for GitHub, eg working copy. If you don't pay for the API, it is limited to about 60 calls per hour.
-
@ccc I do the initial "fork" of the repo using the website. Then I can create branches off my fork's
master
branch and commit to them using the command line. That should also be possible in stash. Once I'm done I send the PR through the website again.If my fork's
master
branch gets outdated, I dogit merge upstream/master
(replaceupstream
with the original repo owner name, or add it as a remote by hand) which should always result in a fast-forward because I never do any changes to mymaster
branch. -
@ywangd Github has the
hub
command-line tool for these things https://hub.github.com. It provides all git functions, as well as some that are specific to GitHub. They recommend aliasinggit
tohub
to make it the default command-line interface for Git. -
@Webmaster4o Thanks I wasn't aware of this tool. But it does not help in our situation as it cannot run inside Pythonista or even iOS. It is written in Go.
-
@ywangd Right. I was just pointing it out ;)