OK. I am here to ask a GIT question. I have recently read through the "always work on a branch" page. Now hesitant since I may have used a sequence that screws up the preferred or normal workflow. So here is my sequence: Used github via browser to fork from CircuitPython (7/22/22). Cloned to my local repo on my VBox-Ubuntu using command line. Edited files, compiled successfully. Discovered issues. Went back to browser created a branch called 'toyfib'. Now I need the steps to push my changes to branch 'toyfib' for review. My fears: I'll hose one or more of the repos, remote or local. If I need to perform things in a different sequence, I can copy the 7 'new' files off and then perform things as needed. I'll acquire the understanding more by doing...
#help-with-git
1 messages ยท Page 1 of 1 (latest)
create the branch locally, before doing any commits.
- fork repo on github.com
- clone forked repo, and do any setup necessary
git checkout -b my-new-branch- `git commit -a -m "some message"
git push
this is covered in https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github
I did steps 1 & 2 last week. Then added feature dir and files. I assume its safe to continue with 3,4 & 5 now. Yell if not, otherwise going forward...Thanks!
latkinso42@MST-Ubuntu64:~/research/circuitpython$ git commit -a -m "First commit of toy module Fibonacci"
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('python', '-mpip', 'install', '.')
do you have python?
I tried making paths 'long' but it did not help
and python-pip
perhaps it upset because i have python3 / pip3
nope, that's the right one
on Ubuntu
but you may now also need python-is-python3
??
it makes a shortcut for python to point straight to python3
that's not always present
the command it's having trouble with is python
ah yes.. an alias, right?
so if you can type that at the command line and it opens up a python terminal, then the next problem is no pip
but perhaps more
should be good to go with python-is-python3 tho
oofsies. what happens if you type python -v
it complains... python3 opens interpreter
Its whatever the latest Ubuntu has by defualt
how about this, sudo update-alternatives --install /usr/local/bin/python python /usr/bin/python3
sorry, one of my ubuntus has the python-is-python3 package available and the other doesn't, i am not sure why that happens
trying...
basically what's happening is there's a script that says "hey, before you let that commit run, let's run this script first" and that script needs python -mpip install . to work in order to get the files it needs to proceed
does it need a <priority> ?
<priority> == ?
can you type python -v and see python 3.something now?
oops. capital V. man, i'm rusty
V for Version
v for verbose
all to just get a pre-commit hook to work, oofsies
yep, good to go now, try your commit again
Python 3.10.4
oo that's a couple versions newer than mine. is this ubuntu 22.04?
oh no 
what's unhealthy about it?
i've not heard of that, so it must be a part of the checks that that project does before allowing a commit
Need to put Discord on my VBox. Copy and paste not working, even though I turned it on
hard to copy issues..
latkinso42@MST-Ubuntu64:~/research/circuitpython$ git commit -a -m "First commit of toy module Fibonacci"
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('python', '-mpip', 'install', '.')
it should still work with or without the space
fury@FATMAN:~$ python -mpip --version
pip 21.3.1 from /home/fury/.local/lib/python3.8/site-packages/pip (python 3.8)
can I repair this?
Oh you'd need to be in the right folder
Don't know what the right folder is- should be visible in the prehook definition
usually a setup.py or something like that in the current folder
setup.py or pyproject.toml
now python -mpip install .
see if it's failing for some other reason that it won't say when it tries from the commit
and give me a moment to clone the original repo and play along here
i don't think so
what i'm not entirely sure of is if this commit hook is trying to install something for circuitpython or if it's trying to set up the pre-commit hook script itself
cloning the submodules now
yeesh there's a lotta submodules
A multitude!
guess cuz circuitpython supports a lotta devices!
I would assume the pre commit is for something like black but I haven't looked
check submitted code for problems before it gets to GitHub, according to the build circuitpython page
i did this:
Install pip if it is not already installed (Linux only)
sudo apt install python3-pip
Install needed Python packages from pypi.org.
pip3 install --upgrade -r requirements-dev.txt
pip3 install --upgrade -r requirements-doc.txt
and this
cd <your repository clone directory>
You only need to do this once in each clone.
pre-commit install
over a week ago
ok
...... Stuck
weird
ok, here is my log starting from after the submodules finished cloning. the commit worked for me. that's strange
see if i did anything different
i did have to manually install pre-commit though, it didn't come with the requirements-dev.txt like i assume it should've
(maybe this is cause for me to contribute!)
oh.. we are now in a pending dependency queue.
Should I copy my files and rebuild my environment?
maybe, i'm not sure what might've happened and that's a good way to be sure. you can see which files you need to grab by typing git status to see what's staged for commit, if you didn't already
cloning into a new directory and starting the modifications over again may fix whatever went wrong in the pre-commit environment
but i am not familiar with that tool
Did you install pre-commit to begin with
apparently you can type pre-commit run at any time in any circuitpython directory to try it
there's some output lee pasted that suggests pre-commit is present and capable of running
OH
i think i may have an idea
do you have multiple terminal windows open by any chance?
yes
are you doing this in the same window where you set up update-alternatives
close and reopen the window, should be good to go
whatever its path is, it's not aware of the python shortcut
so restarting it may fix that
but i thought /usr/local/bin/ was always in the path
or
if this is an ubuntu virtual machine, may have to restart the desktop session
@brazen crag are you on 22.04? 22.04 and Python 3.10.x is fine for circuitpython development. That's what I'm using
no reason to use a special python environment
still have assertion error
So thats what I thouhgt I put on VBox, It was the latest iso from ubuntu 64 bit
yet when I do uname -a
it says 5.15.0-14 generic
ok..lsb_release -a indicates Jammy 22.04
SO YES!
i guess uname -a is now passe'
cat /etc/issue is what I usually do
Yes its 22.04
ther is an Assertion Error on line 86 of pre-commit/repository.py
not sure what I did or missed to lead to this..
Python is 3.10.4
What's the assertion error being displayed
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy() immediately after install, please open an issue describing your environment
Check the log at /home/latkinso42/.cache/pre-commit/pre-commit.log
yes 2.17.0
I could squirrel my files off the VBox and restart my entire build environment, but that may take several hours
let's figure out how to clean up pre-commit and reinstall it
(Whew) Thanks
try pre-commit uninstall and then pre-commit install. did you try that already?
do pre-commit run to try it before the commit to see if it's still messed up
Assertion Erro still there
so I'm confused, did you mess with the python installation earlier? there was some mention of update-alternatives
Originally it was "An unexpected error has occurred: CalledProcessError: command: ('python', '-mpip', 'install', '.')
fury tried to help and so did Vax
I have never seen that either, it's confusing you would see that
try pre-commit clean, and then pre-commit run again
pre-commit puts stuff in ~/.cache/pre-commit. It looks like uninstall/install does not clean that out
Assertion Error
which python
let me look
pre-commit clean does clean that out
what is dpkg -l python3 is it 3.10.4-0ubuntu2
Yes
have you updated ubuntu recently?
I just got the ISO a week ago. havent looked for an update
is this a PPA issue?
ok try this:
pip3 install --upgrade virtualenv
rm -rf ~/.local/share/virtualenv
it's claimed to be an issue with the python package on 22.04.
after the above uninstall and install and clean pre-commit again
Assertion Error
its a complex environment. You might be doing things uncontiously that I don't think about everyday. I try to be stepwise methodical.. nbut...
I followed gthe older sample 42 pages and preceeding instruction
You indicated they had not been updated in a while
yes but, I wrote the instructions ๐ and our environments appear to match, so there's some difference. I also don't understand this particular failure. I'll do some more reserach. In the meantime, just pre-commit uninstall and forget about it for a bit
I need to figure out the cause because you will not be the only sufferer
@brazen crag I remember some recent python updates (within the past week), so try sudo apt update; sudo apt full-upgrade
Doing that now...will take a bit...
ok. Done. Should I try 'pre-commit run' ?
(sigh) Assertion Error
this env is cursed.
adabot is spicy and angry still, even after reverting the linting change
I figured out how to test that section of the code, so I'll patch it today
@brazen crag since numerous people have reported this (https://github.com/pre-commit/pre-commit/issues?q=is%3Aissue+healthy), it is appears my environment is the odd man out, not yours. You could try a reinstall but it may not fix anything.
Understood!
I appreciate all the help. I'll start the reinstall process and document every step..
Thanks Again. Cheers.
~~Would someone take a look at this adabot patch when they get a chance? Trying to fix the issue that's now causing problems for circuitpython.org: https://github.com/adafruit/adabot/pull/286~~
Actually, I think the integration test might have some useful info for confirming it's unbotched, so will be nice to let the CI finish and read that.
@fierce field looking at the the pre-commit issues most referenced the issue tracker, rather a circular chase. So, looked at the owners most recent updates and figured (guessed) he solved it by going to Python3.11. Most Linux releases can be a step version behind.
Several steps and I added the Alternatives mapping for both python and python3
then reboot for safe measures ( even though shouldnt have to)
pre-commit runs fine!
Yeah!
as long as update-alternatives doesn't break system things. I haven't used that. in the past I have used https://github.com/pyenv/pyenv
So many things to use; so few days. Hopefully i can get the commit to the branch when my head clears to tackle the real issue of no module found. Later...
anyone else on firefox getting this when trying to attach something to a github discussion? guessing it's a browser bug of somekind. just recently (last days) started.
git push
fatal: The current branch toyfib has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin toyfib
What is origin?
That would be the remote repository that you originally cloned your local copy from, typically.
Yeah, when you initially clone you can set the name, but origin is the default and will probably work as-is
SO, the main branch of circuitpython.
Got it ...! Thanks! For me some things I learn merely by reading (conceptual). Others (perhaps git) I will learn by frequency of use. Thanks for your help and patience.
Yeah, it's really a local label for a remote repository. You can in theory have multiple, and the people who make git use it that way. For your average developer who just uses something like github as their repository of truth, you only have one remote, and the default name of origin works just fine
When you make a branch locally and then want to push it out, they want you to confirm which remote you want to push to, since pushing to the wrong one could be a big deal. I do wish there was some way to say I only have one no need to confirm
are you planning on making any pull requests to circuitpython?
@safe crystal I have FF and no problems. I drag and drop files into the comment window and don't use the attach buttons though. Don't know if you're using drag and drop.
thanks. not sure what it was. fixed now. it almost seems like it was some kind of IP based ban GH was doing, since it did same thing on a separate PC. maybe i hit a quota or something? i just escalated the turn-it-off-and-on-again solution to more devices to resolve ๐
Being a Git Newbee: I performed a push of my local repo to a branch of my circuitpython fork. However, my changes are not showing up. So many hoops, hurdles and hills... lost in procedure....Any suggestions as to how to check or resolve the missing directories & files?
Do I use 'git add <file>' or 'git add <newdir/newfile>' to fix?
a quick run of git status can be helpful as well
can use that to check current branch and sanity check what git thinks has changed vs. what you think has changed
i typically use git add . followed by git commit -m (insert comment), but there numerous ways of doing the same thing
the graphic here may help to provide an overall picture:
https://learn.adafruit.com/contribute-to-the-adafruit-learning-system-with-git-and-github/workflow
there's a fair amount of semantics fork, clone, commit, push, pull request etc.
it can def be confusing at first
Also, sanity check: you said you pushed to a branch. If you're looking at github, it'll show you the master/main branch by default. You may have to change what branch you're looking at to see your changes.
Pardon if that's too newbish, but you did say you were new.
Yes, well its been a long time and I never used it much, so near the same thing. I appreciate all the halp.. reading now (first) then will try next. Thanks Again!
that graphic doesn't show branching though
I seemed to have performed a commit and push to a branch. I verified. Thanks for everyone's help! Cheers,
Ok, I have my code and build to a 'good' state. I would like to update everything (remote and local, main and toyfib branch). Whats the bes sequence, so I dont hose anything or stomp on my own added module?
probably git clonegit pull then commit and push
But git is generally pretty good at not letting you shoot yourself in the foot
I think they're beyond cloning. They want to update branches and forks. The issue is, if not done properly, you can end up in a rebase. As I'm unclear on exactly what's been updated where, I hesitate to suggest anything. The short version is git pull remote-name branch-name, and it fetches and merges all of the updates. But like I said, there might be a particular order you want to do it in, all depends on what has been updated with what. I want someone with a bit more experience, or at least more familiarity with your situation to assist.
I cloned (forked to my remote) and copied to my local about 10 days ago. After adding a new module, I then added a branch (I know the goof here). I continued writing my module after checking out the branch on my local. So, first my local & remote main needs to be reconciled with THE MAIN. Second, my branch (local & remote) needs the same (without blowing away my added module.
OK, so you might end up having to do a rebase to reconcile mains. Depends on what was committed while you were still on main locally.
No intention of pushing to the main adafruit circuitpython repository for this toy module...
i see
Right, I know. It wouldn't let you anyway.
Send me a link to your fork. I can at least tell you where to start.
Uff. Your fork started 105 commits behind adafruit:main. You will almost certainly have to rebase to get up to current with Adafruit. I am of no help whatsoever with rebasing, I usually end up starting over entirely when I end up with one. So let me ask you a question. How many files have you changed with this module you're writing? e.g. How far spread are your changes.
One module 'fibonacci'; 4 in common-hal/fibonacci; 3 in shared-bindings; two other in py.
I think I know where you are going
save off the files and start over fresh
Yeah..... Well, not quite.
In this case, you don't need to reclone entirely.
You can save out your files, then go back to latkinso42:main, and do a git pull adafruit main followed by git push latkinso42 main to get up to date.
Then create a new branch and add your changes back.
This should work.
Otherwise you can update main, but your branch will be 105 commits behind, which could indeed require a rebase. There are obviously tons of folks who are comfortable rebasing, it's a skill worth having, but I still haven't gotten to that point.
The process I would normally do: update your main to match adafruit main. There shouldn't be any conflicts because you didn't make changes ot main. Then try to merge main into your branch (the direction is important). This likely will make conflicts, resolve those here. When the conflicts are resolved, your branch should be guaranteed to merge cleanly back into main
I have before under other repositories (not git) but never that many files...
Agreed, but it's the conflicts that I'm concerned about helping through.
I may have inadvertent changes to main on my loca I do not want to push
Ergo, hacky workaround. ๐
Hmm.
@small hemlock Do you have a bit to help? You sound like you're far better equipped to assist.
(I seriously need to get more comfortable with rebasing.)
Most of the time, conflicts with a GUI are pretty easy. You're basically just looking at two bits of code and choosing which one to keep in most cases. If it's a thing you meant to change, you usually pick your code. Otherwise, pick the upstream code.
Maybe familiarity with the code itself would help a lot, and I don't even know much about circuit python. I could try though. At least for a bit until my work meeting.
right. if its my module in main i only wanted in a branch then...?
The first thing to realize is that there's nothing magic about rebasing, it's just a merge that looks a bit different. Some places prefer rebasing, some actually ban rebasing ๐
I think this isn't code-specific. It's simply a mismatch between the original project, the user's fork, and their main and working branch. Thank you!
Ill start by copiing out my files and performing a pull against my main
Copying out your files shouldn't hurt anything, but if they're safely committed on your branch it also shouldn't be necessary
After putting my main back to rights, I'll come back the the branch. Worst case I kill the branch and re-branch and add seven files back
I looked at your changes in main on your repo and at least what's been pushed to github I don't see your name on main
Your main seems to be clean, just behind
rebasing is basically replaying the commits on a new starting commit. The commit hashes then change. A merge creates a single new commit that merges changes together and doesn't change the existing commits
rebasing is nice to produce linear history but changing commit hashes can cause loss of info (if for example, the old commit was already reviewed.)
Yeah, both of them end up with a logical merge between two branches.
The way they do it is different and people have Strong Opinions about which way is right ๐
ok my remote main is in sync with Adafruit Main. The I performed a 'git pull -p' in my local which sync my local with my remote main. However , it mentions changes not staged for commit. It should be clean. whats step to clean any stray references to old unintetional code changes.
Just show git status and see what it says. Pretty sure it gives remedial information.
git diff should show modifications as well.
git status
On branch main
Your branch is up to date with 'origin/main'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git restore <file>..." to discard changes in working directory)
modified: frozen/circuitpython-stage (new commits)
modified: ports/espressif/esp-idf (new commits)
modified: shared-bindings/pulseio/PulseIn.c
things left over from bad file edits on main.
I generally never do work in branch main.
git checkout -b mybranch
do the work there.
yes. however my local main was hosed. trying to bring back to vanilla normal.
There is a way to apply a single diff and do it all in one go.
Really depends if you like the files the way they are right now as to how to check them into the database, for inclusion.
I make a recursive copy and work on the copy, and commit often.
If you're working with other people you can mask that by occasionally copying your finished work over their exisitng work, take a diff and see if it looks like a respectable commit or not.
I know git is powerful and useful for working with lots of code and with others. However, 'reseting' or starting over 'fresh' on one's own system should be as simple as 'start_over'. I see no reason for extraneus complication.. its just time consumming
So back to the status reference of "changes not staged for commit"... I should not have any
git reset --hard
or git reset --hard HEAD~10 and then git pull
note that both with completely destroy all your changes
the second one will also destroy your last 10 commits
still showing 'Changes not staged for commit'
in your repo, or in submodules?
in my local repo, main branch
it shows up to date with main repo, but indicates 'Chnages not staged...'
at this point it would be easier, at least conceptually, to blow away my local. I have nothing to save that isn't stowed away (7 files). Then I could start again. So far, trying to correct my local main has not proven easy or do-able.
i have tried 'git restore <file>', 'git clean', 'git reset --hard'
what does git status say?
same as above at 4:37pm today (look above)
I appreciate everyone's help! It seems Alexander had the correct solution to the Gordian Knot. Obliterate it and go on with more productive things. Ok, maybe he was impatient, un-scholastic and perhaps narcistic. But all I needed was a fresh starting point with no code or outstanding changes. ... I know I need to learn how to untie GIT KNOTS, but perhaps over time. Right now its time to move forward with my project. Time trying to solve git issue today= 3+ hours; time to start fresh with new repo <= 45 min. THANKS AGAIN -- Everyone!
I did nuke-it-from-orbit a lot in the beginning. I can see myself doing so again if I'm under enough time pressure. But it is helpful to eventually figure out how things work and how to diagnose what went wrong
I make a recursive copy and work on the copy. If it doesn't function there's no love lost; just recursively erase it and try again.
If it doesn't say fast forward there's only a small number of circumstances where that's acceptable.
small commits help a lot in making sure no work gets lost due to git fumbles.
I make a test branch ('git checkout -b newbranch') and try a merge on the test branch.
If that succeeds, I merge to the one it came from.
$ git checkout dvlp
$ git checkout -b test-dvlp
$ git merge otherwork
$ git checkout dvlp
$ git merge otherwork
$ git branch -D test-dvlp
The test-dvlp branch creation allows me to not have to recursively copy the entire repository just to test a merge (to make sure it'll go fast forward instead of any other merge strategy).
I keep a local remote repository in addition to the github remote, and update both frequently.
$ git remote -v
localorigin /some/path/to/altair/altair_88x_asl-apps-b-rmt.d/.git (fetch)
localorigin /some/path/to/altair/altair_88x_asl-apps-b-rmt.d/.git (push)
origin git@github.com:wa1tnr/altair_88x_asl-apps-b.git (fetch)
origin git@github.com:wa1tnr/altair_88x_asl-apps-b.git (push)
well i tried to switch my back to main and inadvertently created Main on my local. I guess I could ignore it, but really afraid to remove it.
maybe a git gui like Sourcetree would help with the git commands
My local main indicates two commits ahead of origin/main. I do not recall adding anything and want my local main to be a pure reflection of my remote fork of circuitpython main 'now'. Can I see what these commits are and remove them?
try git log -p -2
Should show you the last two commits
You can also git diff between two references, but the syntax for that is something I always have to look up, then I have to reason about which is + and which is -
but that works if your new commits aren't the most recent two
The -p shows a diff
I mean I diff between two references not limited to any specific amount of commits or anything
the equivalent of checking out both references to two different directories and diffing the directories
I'm cloning a repo onto my machine using GitHub Desktop and it's stuck at Resolving Deltas: 100% (11/11), done. What can I do here?
you could just stop it and restart it again. Delete the clone if necessary
I'll try that thanks
Somehow my local main is three commits ahead of origin/main. Not sure how to reconcile or backout these commits.
I would create a new branch so you can โsaveโ the new commits. Then switch back to main and do a git reset https://git-scm.com/docs/git-reset
Something like:
git checkout -b new_branch
git checkout main
git reset โhard origin/main
Thanks. The three commit are most likely innocuous and unwanted. but good procedure.
After updating my CP fork via the sync fork button, my forked repo on GH is lacking lots of recent tags. I remember having this problem before but can't recall how I fixed it.
git pull --tags the-original-repo main and then git push --tags
replace the-original-repo with the url of the original repo, of course
That (like many things in git) seems roundabout
probably ancient design choices involving not tracking tags separately per-remote, so they're not pulled by default, because they might conflict with tags you've created locally
oh, I'm sure there is some command that does exactly what is needed in one go, but I'm too dumb to know it
Yeah, git was designed for a many-remotes situation that the original architects used a lot
The majority of git users don't use it that way, and don't really understand the edge cases that supporting that way requires
OK, back to a sane build environment now, now I can get onto working on board bringup
In my local main, it appears I have an un-staged path or directory (not a file). I have tried to reset and restore, but no luck.
You could try clean, but I talso depends if it's a submodule I think. What exactly needs to be undone?
what's the msg and path, exactly?
Modified: frozen/Adafruit_Circuitpython_<filename> lots of times
I'm on a virtualBox .. doesnt always copy well
All unstaged
do make fetch-submodules at the top level, or run this alias:
alias gitsubupdate='git submodule sync --quiet --recursive && git submodule update --init'
it's because the frozen librries were updated, probly
Like Magic (my hat is off, have a great evening)
Submodules are tricky, glad it's sorted!
On GitHub, my main is up-to-date, my branch will not sync with main without loosing 31 updates. How do I rconcile?
Issues on Github
You could use git stash or merge the changes
@brazen crag When in doubt, I like to pull in main and do a merge commit.
You can manually tweak where the conflict is then
You could also rebase it, but I do that more for small changes, but those far better at it than I might say differently haha
SO I should resolve on local? I normally just perform a sync on GitHub, but it says it should delete the last 31 changes...SO the solution is resolution at the local level?
that is..non web?
Yeah, sometimes GitHub forces you to do it locally.
Definitely commit all your changes to get a point you can rewind to in the worst case.
Then you can do git pull upstream main (assuming your trying to sync from the upstream)
Then you'll have to resolve any conflicts
I just re-did my vbox and Ubuntu build env. Just cloned my fork of the circuitpython repo and did a checkout of my adcdma branch. No changes.
issue is between main and adcdma branches
so resolve locally , then push upsteam
correct?
Are you trying to pull changes from your main or from Adafruit's main?
My main
Oh, the no need to do it upstream. But yeah, resolve locally with git pull origin main, resolve conflicts, then git push origin main
I make a recursive copy of the local repository, elsewhere on the hard disk, and only pull from the remote on gitub (and not push back to it).
If I can't come up with a fast forward I'll just copy the current state of any files and then do 'git checkout -- filename.ext' to reset the file to what git knows it to be (removes changes made since that file's contents were in a commit).
By making many small commits, I usually avoid suprises. I always make a copy of the merge target ('git checkout -b target-copied') and do a test merge.
The fact that when I do the merge itself (on the original merge target branch) .. its the exact same shred (hex string unique to a merge/commit) that says a lot about how it is deterministic.
I'm trying to use git LFS to store a larger file in Github. I have followed these instructions, except for the last step I used github desktop to commit and push. https://docs.github.com/en/repositories/working-with-files/managing-large-files/configuring-git-large-file-storage I am still getting the error that the file is too large. Do I need to "refresh" something?
False alarm, 'twas a typo
At one time I had my git using GCM so that performing a PUSH was smooth. Now I have to go thru many gymnastics to get everything to work. Is there a better way?
Do folks here find that they use the command line interface or a GUI for source control more in their day jobs?
I teach a few engineering workshops and I have students learn the command line interface. Iโm currently developing an Android app development workshop and the student helping me says his industry contacts use the interface within Android Studio for source control, not the terminal. Another friend of mine that interned at Garmin said everyone used the terminal. Two other friends that work at Google and a video game design company say they always use a GUI. They also think learning the terminal is a bit unnecessary saying, โโฆteaching the concept of source control is more important than the specific method/tool.โ I personally use the command line. I was curious what experiences people here have.
My AP (college-level in high school) Computer Science instructor has us use GitHub Desktop (https://desktop.github.com), and I personally find myself using whatever's nearest for simple things (like git commit -m "Add colors"; git push) but a GUI for more complex things
I use a combination. I think it depends on both what's easier and what specifically.
My file explorer has a terminal in it and if I just want to add all my changes and commit, using the CLI is fastest. But sometimes I'm making a lot of changes and want to commit only specific lines or something like that. At that point, I'm usually in VS Code and just use the builtin git stuff there.
So basically the same as @manic fiber
I use IntelliJ Idea for work and 99% of the time I'm using the integrated interface in it. Personal projects I use command line. In previous jobs I've used command line and something like Git Kraken.
I do feel like I really "learned" git when using it with some UI interface like Git Kraken or SourceTree. The command line was too abstract for me at the time. Being able to see the branching, commits, and merging helped tremendously.
I think I get a lot out of both systems. Command line essential to get work done, but there are 'high fences' to situational awareness to adapt to.
I use gitk for sanity checks, as it's the first GUI tool I encountered that works with git.
I have a nice cli-based recipe to copy files with their edit histories I use on the command line pretty often. It seems to do what I want it to do. Over time I've memorized most of it and almost feel like I understand what it does (a stackexchange code lift ;)
CLI๏ฟฝ-only. I've dabbled with GUIs over the years, but there's always something advanced they can't do, like a fixup commit in an interactive rebase, or using the reflog to recover a lost commit. I haven't worked at a company yet (web dev) where GUI clients were standard. those products seem to come and go, too.
for interactively adding specific lines to a commit, you want git add -p โ life-changer.
Yeah, I'll have to play around with it. Most of the time if I need that level of interactivity I'm probably already in VS Code which is nice. I think the only time I'm ever adding something from the terminal is something like a KiCAD file where I'd never commit anything other than it all, so it ends up working out in the end.
I'm also not big on things like nano or vim but I can see the utility of having that there if you are ๐
ah, VS Code can be your git editor, too!
git config --global core.editor "code --wait"
Weird, my git question from earlier got silently deleted
Apologies. The bot caught it for "repeated words or characters". It's not smart enough to differentiate legitimate messages and spammers.
I assume it was the strings of multiple dashes.
If you like, I can repost it for you, or send you the content via DM and you can try editing it to try to post it again yourself.
I'm trying to install github desktop on an ubuntu VM. I found this instruction set https://gist.github.com/berkorbay/6feda478a00b0432d13f1fc0a50467f1 but after following it, the program doesn't work properly. It just looks like this
How do i update to that?
There's a .deb in that release
Sorry I'm a noob I don't know what that means
I guess I'll have to learn to use the CLI
Because I got the latest to install and it "works" except it doesn't sign me in to my account
weird that github doesn't have a linux install
when setting up a git.config file should user.name be my actual name or my github username if I want to use this with github?
it will be used to format your commit messages. typically your "full name" goes there, and your email address goes in user.email. GitHub matches on email addresses
How much of that is public?
all of it, if you push to a public repository
note that Git will try to synthesize some defaults if you don't set those config variables, and you may or may not like the result
you can have multiple e-mail addresses configured in github, I recommend having a special address just for the commits
I have never remembered to change properly and I can't figure out how to get it to warn me
And I'm on Linux for this project so I'm CLI
warn about what?
I usually just edit ~/.git/config
But you have to remember to do that right
you can also have .git/config in the repository, with different address if you want
if you want to use different names or addresses for different projects
this is not a github thing, by the way, it's just git
you can use something like git config --global user.email foo@example.com and it'll set it in the global config
So on a github public commit, what function does .name have?
Yeah I know but we've been bouncing back and forth
how are you creating the commit?
it's just saved in the commit, as part of the commit data
CLI
it's purely informational
it's so that other people can easily tell who made the commit
you can configure your public commit email in git git config user.email "email@example.com"
that's not entirely true, it's not possible technically to enforce this
as long as you control any domain, you can just setup an alias domain for mailinator or any similar service
they can't possibly blacklist them all
I meant the second half
I didn't even know that there was a Linux edition
Also it might have been said and I just missed it, but you can also use a GitHub generated email that is linked to your account as well, i recently changed mine to this so it shows as me (as in my GitHub account) making commits.
sure, you could set the noreply email address as your default commit email address, if you don't mind a GitHub address being permanently associated with your commits and contributions. note that some projects are moving away from GitHub hosting for moral or ethical reasons, so this isn't a purely theoretical concern
If you choose to you can find it in your settings here:
You can also change your email on a repository basis I believe, but someone can confirm or deny that. So if you need to use a different address for a non-Github repository, you could.
Note that in order to get that email address in the image there's a check box below (not shown in the image) labelled "Keep my email addresses private" that you'll need selected.
This is what I was showing, I guess I didn't recognize the text, my bad.
What are alternatives to GH? SourceTree?
GitLab is one; i haven't looked at it in a while, though
download the .deb file in the release page, and do sudo apt install path/to/the.deb
should work
I leave my global user.name and user.email unset, then set them locally in each local repo clone (usually with a git alias I've defined like git config-personal). GitHub's noreply addresses are great for that. my user.name for commits is always set to my user handle on the git hosting service. you can configure GitHub in particular to block commits that would disclose one of your actual email addresses.
git desktop says i'm 691 behind. how to force it to catch up?
also that merge button is scary
current repo is djdevon3/adafruit_circuitpython
I think based on what you sent that you're looking at the upstream branch - so adafruit/circuitpython. You can go to your repo on GitHub and select your branch (I assume main based on your image) and sync the fork to the upstream.
Then you can fetch from GitHub Desktop which is pointing to your remote that you just sync'd to the upstream
Gah I forgot that step. ๐คฆโโ๏ธ
Hi all! Is there a guide to best practices for using the Mu editor's save-directly-to-device-and-run workflow with git? I assume that I don't want the git repo on the device. What do people do?
That's a good question, I'm curious to hear answers. I just have a local git repo with a bunch of CircuitPython programs and copy / paste it into code.py
Or, is it better to just set up vscode? I'm a user of that but not really for anything advanced. Is there a canned setup for a similar-save-to-deploy workflow โ or something better?
What I'm doing now (with Mu) is: periodically copy code.py and whatever else to a directory on my system HD, and then commit that. But it doesn't feel very elegant โ and is easy to mess up.
Thatโs essentially what Iโm doing. And I agree, it feels fragile.
A little discussion of backup copies here: https://github.com/mu-editor/mu/issues/483. I agree, some kind of "shadow" save would be helpful. But I'd like to see that in VSCode and similar editors as well, and yet haven't found any plugins that do that, though they would be easy to write.
Someone made a tool called piku that is used for setting up CircuitPython projects and deploying them to devices (if I remember correctly that's what it does)
Not sure if that's the right tool for the job here though, since you want to work with the repo and then deploy something different to the device
I basically do what @eager violet and @wanton turtle do as well if it's a microcontroller. If you're working on a SBC like Raspberry Pi, you could do an editable install.
Interesting. Found it on GitHub, doesnโt do exactly what I want, but itโs open source and written in python, so maybe Iโll just use it as a base to build my own deploy scripts.
!I should have specified it as mraleson/piku, sorry!
Also this sounded like a fun project (actually tried it briefly once but didn't stick), so I'm making a CLI for this in my spare time haha
Hey git gurus, if I'm submitting pull requests to Wippersnapper and I was told to bump the version to 52 in my first pull request. What should I do for my second pull request? Rebase off of the first, or cherry-pick the version bump to the second pull request? (I went with cherry-pick) Or something else? (Both are currently based off of Main)
I think github can do the rebase automatically on merge
That's what I thought/hoped, i.e. no cherry pick, it'll just merge it nicely as long as not too messy auto-merge.
Thanks @cloud hound
Hi all! I have a folder with another repo that was cloned into it as an imported library, but I don't have a repo for it yet on github. After running git init -b main and git add ., I get this warning/hint: "You've added another git repository inside your current repository. Clones of the outer repository will not contain the contents of the embedded repository and will not know how to obtain it. If you meant to add a submodule, use: git submodule add <url> lvgl" but I want to add a submodule and the main repo it's contained in. Is there a way to create/push the repo and have the submodule retained within it? How would I go about resolving this?
I'm also worried because I modified the submodule after cloning and I don't want the modifications to be overwritten. Running git submodule add https://github.com/lvgl/lvgl.git lvgl gives me "fatal: 'lvgl' already exists in the index"
wait so did you modify the submodule?
because if not you just need to pull the submodule every so often and commit the updated version
yeah so if you didn't modify the submodule I'd delete the folder then run that command again
the folder being lvgl
Is this your own library in the "submodule"? Copy the code into a separate directory tree, init it, and make a repo out of it. Then remove it from the parent repo clone, and set it up as a submodule
That makes sense, thank you!
I did modify the submodule but I think I might not need to if I restructure my code a bit. From looking at other repos that include LVGL, it seems the standard is leaving the external library untouched and copying templates out of it instead of renaming and using the templates directly
Hi guys, I'm in Ubuntu and made some CP changes and trying to commit to my branch, and getting an error I've never seen before:
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: AssertionError: BUG: expected environment for python to be healthy immediately after install, please open an issue describing your environment
more info:
virtualenv python version did not match created version:
- actual version: <<error retrieving version from /home/gpeyton/.cache/pre-commit/repodk7pays9/py_env-python3/bin/python>>
- expected version: 3.10.6.final.0
Check the log at /home/gpeyton/.cache/pre-commit/pre-commit.log
Any tips? Just scared of messing up my environment!
Cross-posting is usually discouraged, but in this case I'd recommend asking in #circuitpython-dev
Solved on #circuitpython-dev using this guide:
https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/check-your-code
I use VS Code for editing the git repos on my laptop. I have a command alias set up in my terminal so that when I enter the command โcpcโ, it runs the command โcp code.py /Volumes/CIRCUITPY/code.pyโ which copies code.py from the current working directory to the CircuitPython device mounted on my Mac. I usually have a couple tabs in iTerm, one of them just for copying files, and one for tio connecting to the serial io. Tio is great at reconnecting after reboots.
Hi guys so I'm having a problem with setting up my pi zero w with pitft screen using retropie command prompts I've been following the guide for the pigrrl zero but the installation code that's on the guide doesn't do what its supposed to do
Where is a good place to ask about frozen modules, i.e. accessing them after compiling?
I followed the instructions on the Adafruit Learn page and had a successful compile of DotStar into a Trinket M0 build.
Copied the .UF2 and awesomeness. But I can't figure out how to import the frozen module. Nothing on the Learn page about THAT. I tried adafruit_dotstar and Adafruit_CircuitPython_DotStar
Nada
Hmm.
That's odd, that's exactly how it's supposed to work. The correct form is import adafruit_dotstar.
OK give me a moment.
I looked at the .py for the DotStar and saw that is was called adafruit_dotstar so I tried it. Still says no module by that name. ๐คจ
I'm thinking there's a step you missed in adding it. Can you send me the UF2 please? I'll grab a trinket and try it.
Wow, great. Where do I send it ?
Drag and drop it into Discord. It should add it to a message, and you can send it here.
k
Actually, are you using the application or using Discord through a browser?
The App
Perfect.
k
There's not enough room on Trinket M0 to build DotStar into it. The reason nothing is working is that it's failing memory allocation as it tries to import DotStar. So it's not that the module isn't found, it's that it can't actually import it properly.
Can you post your mpconfigboard.mk file here as well? I'd like to check what you did anyway.
You may have done it all properly.
Ah, interesting. So I have to use it from the /lib
yeah, gimme a sec
There's no external flash on Trinket, which is to say a flash chip separate from the microcontroller chip.
So it's space is very tight.
@pine plume And a thought occurred to me now - this conversation would have been better suited to #help-with-circuitpython. No worries! I happened to notice it here. But you'll get more opportunities for assistance in that channel for questions like this in the future. ๐
Purrrfect
I am assuming, then, that the compiler does not report that module as being too big to fit in the core CP binary for that board.
In fact, it does. The build will fail to complete and it will tell you how much too big it is.
I managed to get the same results you're having.
I got past the memory error by shortening up my code.
So we'll troubleshoot your freezing process now.
Ohhh! Okay.
OK, that looks right.
Am I misunderstanding the build output? Looks like it worked.
Did you drag the library directory into the frozen directory in root of the CircuitPython repo clone?
It did build successfully. That's why I want to sort out how you built it.
No, it was already there.
Oh right.
okay ๐
It's frozen into other things, yeah.
Gotcha.
Hmph.
Memory on the Trinky has always been a problem ๐ฆ
Yeah, for sure.
I was just trying to be clever.
Ok, we're building it with DotStar frozen in to see what happens.
k
Pretty simple, it seemed. And there are no other frozen modules I can remove from the Trinky!
Side note, you should always run make BOARD=board_name clean before you do a new build. That removes any possible previous build data so nothing gets smushed up.
Good practice anyway. Even if you've never built before. Because you'll almost certainly build again. ๐
OK, now it tries to import dotstar, but fails on the dependency adafruit_pixelbuf. We're trying to freeze that as well.
I guess I should be turning verbose on to see this?
Actually, make clean is necessary if you change mpconfigboard.mk or other make-related files.
k ! thanks !
This is from the REPL on the Trinket.
Well, ๐ฉ
So this time CircuitPython isn't complaining about not finding DotStar, it's complaining about not finding it's mate.
It did not give me that in the REPL
k
Ooh, it imports!
OK, so I'll send you this build. You have to download the library bundle from https://circuitpython.org/libraries for 8.x, and get adafruit_pixelbuf.mpy out of it and toss it on your Trinket in the lib folder. That's the dependency DotStar wants.
Ok
Let's at least test that it works for you too.
And if it does, try doing the make clean before the make build, and see if that helps your build.
k lemme grab my Trinky
Wait. I just loaded that new build, and it's still not working for me.
Nor I.
Somethings not right, it's not reading the same version as it should. Hold on.
No problems, I got all the day. But don't burn your time on this.
I feel the pain.
I know about the dependancies, and I thought the compiler would complain about them. But, eh.
Compiler doesn't complain. It's CircuitPython that complains when you manage to import the lib with the dependency.
Compiler doesn't care, you are correct.
Gotcha.
I was just sooo happy that my first ever core build worked, my hubris demanded I try a frozen module. And, here we are.
I'll find out if we did anything different to make it work.
๐ ๐
But first, we have to figure out why my firmware isn't the right one.
If you want to pop over to the circuitpython channel, I can do that.
Sure!
This library is not updated in the registry, can someone take a look please https://github.com/adafruit/Adafruit_LvGL_Glue/issues/15#issuecomment-1337411808
Sorry for cross-posting, I've bunged the same issue in arduino by mistake as this channel seems more appropriate.
After making a minor code change, started seeing a pylint workflow error for a previously-submitted Community Bundle library. Pre-commit had no issues and the error is unrelated to the code change. Were there changes made to the build process for Community Bundle source repositories or am I missing something obvious?
Your CI is now using updated Python version because it uses "3.X", which causes issues with importing down the line
Upgrading to the latest pylint in .pre-commit-config.yaml and regenerating the .pylintrc file will fix it
You may find some new uncovered linting issues with the new pylint, just a heads up
You can either pip install that version of pylint and use pylint --generate-rcfile > .pylintrc to create it, or reference any of the Adafruit bundle libraries, they all have this issue fixed.
They use pylint 2.15.5 I believe so I would pin it to that and then just copy that .pylintrc it has if you go that route
Ah yes, I see that there's a version change in there when comparing it to a recent cookiecutter-generated repo (that is working). Thank you for your quick and helpful reply @thorn star !
No problem! Luckily it was something I fixed so I recognized it 
I've got a bunch of these that'll need fixing. ๐ค
It's working! All I had to do was change the version number in the .pre-commit-config.yaml file, but am copying over a working .pylintrc just to put a bow on it. Some day I may begin to understand CI, hopefully.
Thanks again and have a wonderful holiday, @thorn star !
My pleasure! Happy holidays!
Is there a generally accepted way to give attribution in git commits?
Making an @ mention to a github/gitlab/etc. account seems dependent on which service you're pushing to.
Specifically, I got a great review of a repo's README, and I want to thank the person.
first name last name is generally accepted in legal sense
good to know
I mean, yes, but I'm just wondering if there is a convention beyond that.
you could ask them how they want to be credited?
if they commented on a given platform, using their handle that they use on that platform might work
Anybody know if there's a good way to make tree exclude with the rules from your .gitignore?
I googled around a bit, didn't see anything particularly elegant unfortunately
Could you elaborate on what you mean by tree?
the tree command in linux, I'd wager
Yeah itโs a fairly common (but not always default-installed) program that prints a directory tree to the console. The -I flag will ignore a directory, but Iโd like to ignore the whole list of files specified by .gitignore
I did man tree on Ubuntu 22.04 and I see --gitignore as an option.
tree is v2.0.2
Woah! I checked just now on Debian 11.6, tree 1.8, doesnโt seem to have the option. On my Mac, brew installs 2.something, which does
Too bad itโs not in debian stable. Thanks for finding it though!
source is available here: https://gitlab.com/OldManProgrammer/unix-tree you could probably build it easily
what's the argument for merge commits, as opposed to linear history?
I guess it might help you filter on important points in history, without squashing commits or tagging?
I wonder if there's a way to force a merge commit, but only allow a merge if you could have fast forwarded?
My personal experience has been that it's a lot easier to mess up a rebase. I even went to a talk a few years ago where someone was extolling the virtues of rebase in an demo example, and managed to mess it up. A clean line of commits is nice, but we've found it doesn't really make a lot of difference in the long run when examining history.
A websearch will give you some essays describing the trade-offs
yeah. every merge event is an opportunity for hidden merge conflicts. even if overlapping lines are not modified, there can be semantic changes that make the merge break the code. every commit that's updated during a rebase effectively counts as its own merge, so that's many more places for that effect to happen
@cedar temple ^^ last 2
can i ask question related gitlab here?
sure, but not sure how many people have experience with gitlab vs github
Exception has occurred: InvalidGitRepositoryError
exception: no description
File "C:\Users\Administrator\Desktop\New folder\project\cloud download\cloud.py", line 19, in <module>
repo = git.Repo(download_path)
usually when you clone, it creates a new dir that actually has the repo in it
not sure if that's what's happening here? maybe you're one directory up from where you need to be?
it's 5:28 am here lil clueless , i just created a new folder in local dir and tried to get files from repo's sub folder
also project id can be obtained by two methods one is by visting url wit token id another under poject name both should be same but they are differernt
blast from the past, I just found this in gitlab settings labeled "semi-linear merge"
it seems like you have leaked a PAT. I'd remove it from the message and regenerate it on gitlab. PAT are like passwords. DO NOT share em ; )
@keen thicket I have deleted that message with your code because you leaked a private credential. You should revoke it as well, since it has already been in public
Thanks.
I'm having problems pushing to my fork of the Adafruit_CircuitPython_MCP2515, I have no idea what this "Run Build CI Workflow" is, it starts on my GitHub after I push the committed changes to the fork on my github. This is the first time that I've ever worked on someone else's repo, I've only used git with my own repositories...
What is this "Hook ID:black" and how can I fix it? I'd guess this is also why it exits with code 1
we use a program called "black" to format the python code, and that hook checks that the formatting is correct
you can pip install black on your machine and then run it on the files you have modified, and it will reformat them
it's practically impossible to guess what it didn't like in your formatting otherwise
Great, that fixed the problem
probably a simple question for those in the know: if i add an (existing) remote, i have to specify a remote name. What is this? id say that the name of the repo is the name (basically the url), but that is already specified in the add command. using vs code.
The remote name is a (typically short) user-identifiable name for the the remote. An example is origin which is often the remote name of the main remote. Additionally, if I were to fork something on GitHub (say adafruit/circuitpython so I have tekktrik/circuitpython) and clone that fork, traditionally tekktrik/circuitpython would be origin and adafruit/circuitpython would be upstream.
Remote names are used in a few places, like if I wanted to merge the upstream's (adafruit/circuitpython) main branch into my local one, I would do git pull upstream main.
It saves you having to ever have to type out the full git URL
@true stump
sorry for the delayed tag
thanks for the answer. so, i have created repos (via github classroom) for my students. i want them to have the repo reflect whats on their Pyportal. they open Volumes/Circuitpy and then (from here i dont know) they add remote. vs code ask for a name. when i give it "origin", it says it already exists.
origin is typically the default name when you clone, so no surprise that it's taken. You can use any name you like, so pick one that sounds descriptive. My recommendation is that you may need to type it a lot so make it relatively short. Based on your explanation, you could use example, teacher, or demo, but anything (besides origin) should work.
If their repository is a fork of your own repo, they could also use upstream to reflect that.
but i want to use the "origin" one, for all of them, for simplicity. so how do i "connect" to that repo (-name) without adding a new name or it doesnt matter? my knowledge is little as you see, i can hardly formulate the question ๐
@true stump Are you asking how they can connect their forks to your own repo?
@thorn star no, they all have their own repo (github classoom sees to that)
@true stump and they're going to connect it to yours, right? If so, you'll either need to pick a non-origin name (since their own remote would be origin) or have them rename their own remote name off of origin.
Note that the latter option comes with the complication that many online guides and tutorials may assume your own remote is named origin so outside help may be more difficult to use if they aren't aware of that.
If that is an issue.
Oh wait I think I understand
No, if you're connecting to a different git remote URL, you must give it a name
@thorn star no i have a repo template, classroom copies this so they get their own. theyre gonna stay and do the PRs to their own (till the course ends). maybe they just do push instead of add?
If they're getting a copy of the repo, it is likely much easier for them to push to their own repositories. If they can push to a shared one (if I understand correctly), you'll need to be careful with both how they name their branches (you don't want multiple students pushing their code to the same branch) as well as what branches can be pushed to (make sure only you can push to main, for example).
But to be honest, I'm not familiar with GitHub Classroom so there may be pieces I'm missing.
just tried it, push also ask for a name...
What happens if you use git remote?
well, we can forget about copies and how the repos were created. if i have a repo on github, and want it to reflect whats on my pyportal, how do i do? sorry about confusion
CIRCUITPY axelmansson$ pwd
/Volumes/CIRCUITPY
Axels-MacBook-Pro-1602:CIRCUITPY axelmansson$ git remote
fatal: Unable to read current working directory: No such file or directory
Have you used git before? I ask because I can provide resources if that's the case.
basicallly no CLi, trying to start using it from within vs code for pedagogical reasons
my orignal plan was to have them clone their own repo to the Pyportal, but github Desktop and Classroom create a folder (based on their user name and classroom) not on root, so the pyportal wont se code.py on the root..
so that didnt work (easily). now im asking to go the opposite way; have the repo reflect whats on the root on CPY. but then i got this name issue..
That's expected behavior, you'd basically have to copy/paste the contents of that cloned folder onto the PyPortal (including the .git folder).
There isn't an automated way to have the repo reflect the state of the PyPortal, and git remote add will only work with git URLs (like GitHub, Gitlab, etc.)
Note that this would work (I think), though it means you'll have that .git folder on there. If it isn't too large, it may not be a problem.
well we have the URL, i just get confused by this name -thing
The name is a just a shorthand reference for that URL
well, we did drag and drop inside vs code to elevate the files from the folder to the root and then push it.. i think i worked, but the class ended before i could confirm
yeah, probably ill just have them use a name, but i can feel the issues coming up if they choose freely
pull from?
Are you asking how they should pull from it?
well, that gave me conflicts
im gonna format the CPY now
well, after formatting, there are still (newly created) files on the root of the CPY, and you cant clone into a folder that is not empty... if i clone via Github Desktop it creates a folder on CPY, not root, so it wont work. if i moved the files, its no longer in the folder connected to the repo. this is a special case i guess.
@pallid thicket clones the repo to the HDD and then copy paste into the CPY when testing, but i can see my students forgetting/confused which is which. this is high school i should add..
keeping a repo on the CIRCUITPY drive is generally not the best idea
I recommend keeping it on your disk, and only copying the files as needed
keeping a repo on a removable drive that is? because of hidden files, space and the fact that you might not have it with you? and then you have a new project and the foldername (Volumes/Cicuitpython) is the same?
the filesystem on CIRCUITPY is FAT12, it's not very good for storing a large number of files, and every time you write to it, the board restarts, which can lead to file corruption
its just really nice to commit/push when you solved an issue without having to keep track of which version is in the HDD folder (and libs et al)
also the flash memory on which it is all stored has some limits on the number of writes it can survive
aha
the number is large, but by making, say, 10 times more writes, you make it 10 times smaller...
well, we need a learn guide on best practice (for high school students that know nothing of CLI) connecting Vs Code-CPY-github methinks..
I agree that actually doing git on the drive isn't advisable, sorry I should have mentioned that.
If you see a guide that you think would benefit from that information, please feel free to use the link in it to suggest so. I believe it's something like "Feedback? Corrections?".
ive asked for a guide and maybe there will be one. however, i mentioned some of things in the request that im not really qualified to specify, due to noobiness. my hope is to be able to teach on high school level using it. and you experts should take all the considerations ive never even thought of ๐ thanks for your hellp
is there a git repo with 3D models in it, like the circuit playground...I downmloaded one in the past and I cannot remember where from, thanks!
search for adafruit CAD, theres is a repo
that did the trick, thank you
I'm trying to setup a pygamer with a mario type game. going well until this... in__init__ File "adafruit_pybadger/pybadger_base.py", line 156, in __init__ ValueError: SPEAKER_ENABLE in use Not sure how to fix this error. is anyone in the know on the pygamer tip?
This is better suited to #help-with-projects. We discourage crossposting, but in this case I'm suggesting it.
Actually scratch that.
#help-with-circuitpython is best.
Ah ok. No worries. Avoid it in the future. Most of the folks here are community members volunteering their time, so please be patient with folks in terms of responding to you. The server is often more active earlier in the day Eastern Time.
ok
Thanks!
I have a new machine that's linked with my other machine. So my github folder mirrored over. So github is complaining that my repo has files in it and it can't clone
This seems like a solved problem?
Oh duh
Did you resolve this?
I use rsync for direct PC to PC transfer for large transfers (bought a new PC). Usually to an otherwise empty directory, then manage it locally (assuming the landing zone is large enough to contain two copies of all that was brought over ;)
(Linux-centric obviously; idk what other OS's provide for similar function).
For git, git clone is usual, I think.
(and fork on github.com as that's a rare activity)
I always make a local git clone of a local repository so there's three in total; two local and one on github, all pointing to the same commits. ;)
I call them 'origin' (github hosted) and 'localorigin' (self-hosted thru filesystem).
That way I get a 'push and forget' strategy going and do frequent commits. Very frequent.
Then merge every so often and push to github.
'top down; bottom up; middle out' dev strategy falls out of that thru commit history review. ;)
Second to rsync , very versatile in linux making files available elsewhere such as Google drive
I ran rsync as a deamon in a headless Ubuntu server. Worked very well with about a minute each side of file modifications to sync elsewhere
Hello! I recently setup a NAS at home. I am a pretty new python programmer but I am starting to get to the point I want to do proper version control. I was exploring the options of using github, or setting up a git server on my synology nas (supported) . I am just wondering what you guys with more experience think? I am using pycharm community as a IDE
id say you go with github. there are plenty of extension (at least for vs code) and it has work flows figured out since years. also, its free. and, you can share your code with all of us!
I used pycharm for version control with git and github. So I would recommend it.
I am in the process of setting it up
I had created the git repo, but then realized I had a ton of stuff i needed to delete
now im trying to figure out how to remove it from the repo
basically I had a bunhc of large files in the directory. So i went to push and I got an error from github for the file size. So I deleted them then commited and pushed but its still trying to push the large files i deleted
Has anyone here used GitHub Pages? I set up a really basic page and was hoping someone here had one theyโd be willing to share. If you share an example that required any special services you had to sign up for or complicated build steps please say so. Just so I know whatโs required to make something similar.
Just looking to have a landing static page?
Thatโs enough to start with, yes. Long term Iโd like to make it slightly interactive, but anything beyond three lines of text in the default template is a win a far as Iโm concerned. This is all I have been able to get working so far:
http://griffin-instruments.github.io
This is a placeholder for where operant box and other lab projects will be shared. Bookmark this page to keep an eye on these project updates!
Nice I'm not as familiar with jekyll and more used to sticking a index.html file in a repo like that. But you can essential edit the markdown file to include whatever you want shown on the page
Do you have an example I could look at?
https://a3k.github.io/ be warned it's a project I never got very far on but does have a bit of JS running (Repo: https://github.com/A3K/A3K.github.io )
What is git status meaning when it says, e.g.:
modified: lib/tinyusb (new commits)
modified: ports/broadcom/firmware (modified content)
Submodules are code from other repositories?
I just pulled the whole circuitpython repo. Why I get this information? Should I do something?
make fetch-submodules
ok, didn't know that I should do this from time to time
but the thing with broadcom/firmwareis allready there
but I think, this is not where I'm working on. Maybe it's better if I don't care
this sort of thing can sometimes happen if a repository contains generated files that were checked in, and your local build somehow regenerated those files
(generally, generated files should not be checked into version control without good reason. if there is good reason, the default build process should not regenerate them, if possible, to avoid this sort of confusion)
This one shows up if you are on a case insensitive file system. You can ignore it unless you are working on the Broadcom port
Is my circuitpython fork allways up to date? If not, how can I update it?
There is usually an option on GitHub to sync your fork with the main circuitpython repo
Thanks! Found it.
Hi
I updated my board build files (BrainBoardz Neuron) on adafruit/circuitpython about two weeks ago. At the time circuitpython.org was on version 8.0.3. I recently noticed the CP is now on 8.0.4. That update happened about a week after my pull request was approved. But, when I test that firmware (and the 8.1.0 beta) on circuitpython.org the firmware does not contain the changes implemented in my last board files update. Is there is a significant delay between adafruit/circuitpython file changes and when changes are implemented on firmware files are being generated for circuitpython.org? If not perhaps something I missed?
Your PR was probably to main, not the 8.0.x branch. 8.1.0-beta.0, which came from main, is older than your changes. So your changes will be in 8.1.0-beta.1, which I think will happen rather soon.
without backporting your changes to 8.0.x, they will not show up in an 8.0.x release, and we are not at the moment planning another 8.0.x, as we don't have a serious bug to fix there right now
this is not really a git issue, #circuitpython-dev is the right place for it
Thanks for the clarification. I'll wait for 8.1.0 beta.1 then. I'll also post to #circuit-python-dev from here on.
I submitted a pull request for seesaw the other day. It failed CI with a very helpful 'This job failed' error. I boggle.
Seems to be an issue with GitHub Actions. One of the repo admins will have to address it.
Assuming this is your PR - https://github.com/adafruit/seesaw/pull/63
rerunning
@lofty chasm @azure stump I think the problem is that .github/workflows/build.yml was specifying ubuntu-16.04, which was discontinued by GitHub Actions in September 2021 ๐
There are further changes to be made to bring it up to date.
Thanks @fierce field
Aha, yeah that's just a little bit old. :)
Where is the documentation located?
Which documentation?
The documentation of usb_cdc
For circuitpython?
yes
I want to make a pull request. I need the location in the source, if it is there ๐ค
Itโs under the ports on the circuitpython GitHub
Whoops sorry
You need to fork it, make your changes on a branch, test, and then submit a PR
If you run into issues building or have other questions, you can ask in #circuitpython-dev
@gritty mural sorry that I can't say what I want.
I've probably found a mistake in the documentation. Is the documentation also written in the circuitpython repo?
That would be a question for #circuitpython-dev
@steady carbon you want to edit the //| lines in https://github.com/adafruit/circuitpython/blob/main/shared-bindings/usb_cdc/__init__.c
@fierce field thanks. This is what I was trying to find.
I believe itโs git prune
I've never heard of that. Does it clear out multiples? I only want to delete one.
I thought it was git branch -SOMETHING branch-name
prune looks handy though.
It does not appear to work on one branch though.
You can also do git branch โdelete <branch>
Guess I could have used -help in the first place. ๐คฆ๐ปโโ๏ธ
Lol
Yeah, got it. Thank you!
-d also works, apparently.
Hahaha, thank you. And thank you for accommodating my laziness and forgetfulness. ๐
Mark of a true software developer (even tangential ones) is the ability to source out knowledge by all means except the official source documentation
Nice
fwiw prune removes unreferenced objects, it doesn't affect branches. It's not really ever meant to be called directly โ it's automatically called as part of automatic git gcs.
You might also see git remote prune, which deletes remote tracking refs which no longer exist on the remote โ this one's definitely good to know.
Yeah, I was thinking if you deleted a branch on your remote repository and didnโt do that locally. Post branch delete actions. Lolโฆ
yep! so you wanna git branch -d local and git remote prune origin (or whatever your remote name is)
otherwise you'll still see it listed as remotes/origin/blah when you git branch -a
Yeah, this is the issue with me trying to help while working lol.. I canโt nuance my own thoughts in my head to be clear lol
Yay adulting
i used to work on git systems at github so i plan to squat this channel basically ^_^v
Lol good to know we have an expert ๐
Welcome and thanks! I'm sure we will have questions ๐
thank you! happy to help
Not hardware but don't I have a way within GitHub pages, to force mobile viewers to use the desktop site?
Say I have an open pr in a project, and have commited stuff to that PR. Now the class where that code would go was extracted and split into two classes. My code being the one in the new class
What do I do
Because if I try to rebase my branch onto upstream I can't because my commits apply code onto file where those fucntions don't exist anymore
You will likely need to create a new branch and convert the changes over. I donโt think thereโs much way around it given itโs a breaking change thatโs messed with your PR.
yeeee
I guess I can just put all the incoming changes onto my branch
Close your current PR with a comment about how recent merged code broke your PR
Or you could rebase
But it could be messy
When a refactoring change, code moving to other locations as yours is, causes my branch to become chaos I often will make sure that the current state of the PR works on the pre-chaos commit point and then do one of two things depending on what is important to you
If keeping a clean history is important: do a single commit that brings in the new structure and then another commit to show what you needed to change. Having a commit be broken for a short bit is ok, for this the path to correctness is the key
If keeping the code functional is your goal, then drop the branch and PR in the rubbish bin and start over as the point is to give the project something new. This can be done via a rebase or just brute force.
i ended up just force pushing back to pre change and rebased main onto the branch and recommitted my stuff...
rebasing is great for this type of event
Ow my head. How did that edit sneak into *that* branch. (rhetorical)
I'm trying to make a pull request for https://github.com/adafruit/Adafruit_CAD_Parts/pull/125
that wasn't a link but ok dynobot ๐ค
it says ```py
Merge branch 'main' of https://github.com/DJDevon3/Adafruit_CAD_Parts
i feel like i did it wrong. i did pull origin and tried to make sure both repos matched before submitting the PR
i only want to merge the 1 part not the whole library... just want to ensure i'm not going to mess anything up if it's saying merge the entire cad parts library.
Don't make a PR from main. Make your own branch first. But it sounds like your fork was far behind.
i should make a branch for every part?
How many parts are you submitting?
just 1 3d model in different formats
If you edit main, then your main can become different from upstream's main. It's better to have your main be the same as upstream. So always branch. You can submit multiple parts in one PR on that branch.
You could just delete your fork and make a new fork again. Then clone it, make a branch, make the edits, and commit.
you can just close the PR
no harm done
not a big deal. If you think your PR is OK, then it can be reviewed anyway. I'm giving longer-term advice.
I thought maybe you had a zillion changes
but I see that is not the case
Makes sense. If I'm pushing to my own personal projects repo I just work from the main fork but for adafruit stuff i should be creating branches too.
and i don't need to keep forks open unless i'm working on something in it. like for circuit python main i rarely contribute so can just delete/create a fork every time i want to contribute something.
slowly starting to get the hang of it, thank you.
I wouldn't say you need to create/delete a fork. If you work on your own branch, but keep its main up to date, then you can keep the same fork. I have never re-created my circuitpython fork. I "have" re-cloned it any number of times. Once your PR is accepted, you can delete the PR branch, but you don't have to, if you want to keep it for posterity (but it's in the PR, so you can always look it up). I was just suggesting deleting your fork now in case you don't want to try to clean up the main branch in it.
And that is why I waited for Dan to reply. Heh.
yeah deleting and starting fresh
ahh i see all i had to do was delete the folder and reclone
Yes!
i'm using github desktop so no cmd line. i like it.
well now it's doubly freshy fresh ๐
The thing is you want to make sure you keep your fork up to date. Not every day or anything. But before you start a contribution, it's best to do whatever is GitHub Desktop's equivalent of git pull the-original-remote main and git push your-remote main. That way you're starting on the same page from your fork and the original repo. Also, there's a button on GitHub that will update your fork.
Don't worry right this minute. Essentially, there are some basic things you want to do as your contribution process to make sure everything goes smoothly every time. You'll get the hang of it the more you do it. ๐
Took me a bit, but now it's automatic. I still don't know how to do a lot of Git things, but my basic workflow is pretty solid now.
Now it's asking if i want to merge my new branch with my new main
thought i was starting to understand it but nope
i have to review and approve a pull request for my own branch to main, weird.
checkout your present main and do a push -f to override the old stuff you pushed to main for the PR
you don't need to PR your own fork
I mean delete the fork on GitHub, not just remove the clone.
fork != clone
the guide will get you started
I'm using Visual Studio (not VS code) to edit, and it creates a .vs folder in my local repo. I'm not going to git add that folder, but is there any way to silence the notifications I get about it from git status.? I want to do this purely locally, so I don't disturb origin when I submit my changes.
add it to your global git ignore
you can also add it to the file .git\info\exclude -- that's per-repo, but won't be tracked
Next problem. working through the flow on https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github/status-add-commit-push I'm to the point I want to push. I entered:
git push -u origin dhcp-buffer-overrun
and was greeted by the following:
error: src refspec dhcp-buffer-overrun does not match any
error: failed to push some refs to 'https://github.com/dgnuff/Adafruit_CircuitPython_Wiznet5k.git'
which kinda makes me say "Well no kidding, Captain Obvious". Of course dhcp-buffer-overrun doesn't exist on my github repo because I haven't pushed it yet.
src refspec means it can't see your local one yet!
are you certain the local branch is called that?
what does git branch -a show?
derp - it's dhcp-buffer-overflow not overrun.
:D
Iโm having a problem with connecting Makecode with github. I follow the process but keep getting an incorrect token format. Any ideas out there
maybe some screenshots of what you're seeing would help? it's hard to know what you're trying or getting.
i have a git account and press this link in Makecode
it takes me here and I select REPOs scope
i generate a token. I copy the token and paste it back into Makecode and press Go ahead and it pops up a red box with "invalid token format" shown on the screen. I can't capture it because it only stays up for a second.
You pasted a screenshot showing your GitHub token. Please remove the image, and generate a new GitHub token as soon as possible. You should never share your actual token with anyone. They're meant to be kept private as they allow entities to interact with your GitHub account using the features scoped out in the token. You haven't done anything wrong. I'm simply ensuring you keep your account safe!
Looking at it, I think you have to delete the whole message. That image can stay up as long as you revoke the token. It's still preferable that you blur it out and repost the message with all four images again.
i can delete the token in git hub so it is no longer valid.
also it only allows access to that project and scope so no biggy
Ok, that would be good. Delete the token in GitHub, and remember not to share the new one. ๐
๐
This seems to be an issue with MakeCode that was resolved in the beta as mentioned in https://github.com/microsoft/pxt-microbit/issues/4034
You can resolve this by using https://makecode.adafruit.com/beta#editor and then click on the GitHub button at the bottom.
Instead of using the token, you can sign in with GitHub as shown below:
This blog talks about the new button and OAuth integration - https://makecode.com/blog/makecode-with-github
Looks like you will have to continue using the beta for the integration to work.
Thanks Iโll give it a try
git tutorial?
For contributing to CircuitPython? Or in general. Actually, this one teaches a general workflow either way. https://learn.adafruit.com/contribute-to-circuitpython-with-git-and-github But if you're looking for more in depth stuff, check out their documentation. It's quite thorough.
Just basics, its my first time using git and thank you.
ohh you wrote it XD
Ooh nice! Ok, so yeah, that guide teaches the workflow I was taught when I first started. I still use it to this day. ๐
You're entirely welcome! Feel free to post any questions here and folks will be able to help you along the way.
I took another crack at making a PR on 'seesaw'. It is improved! It is, however, failing on the 'install deps' part of the test, with missing dependencies on gcc-arm-embedded.
On GitHub? Or locally for you?
On github, yes. Upon doing the 'open pull request'.
Ok, I don't think that's a you-problem. I think it's a CI (continuous integration, that's what runs all the checks) or GitHub problem. Can you send me a link?
Ok, I reran the job, and it failed a second time. I'm going to hand this off to someone with more Arduino CI knowledge than I have. Sit tight, and hopefully they'll get it sorted soon.
Thank you! I'm glad to get it this far.
Great job with that!
@lofty chasm yep, its failing as it looks like the workflow itself is sort of broken. it's nothing with the code in your PR. but also, that repo isn't super maintained, so it could be a while before there is any activity there.
Heh, yeah I know. I have a board port to follow up with, this one is a hello world.
The appearance of this diff is so weird: I have never seen this before. Does anyone know what this is trying to indicate?
Seems to be trying to indicate a syntax error in the TOML file, I presume because that's being wrapped in some additional scripting language with the {%} commands.
something broke?
Need some help with https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k/pull/110/checks It appears to be failinfg one of the checks, I just can't figure out what's wrong and how to fix it?
Run pre-commit run --all-files
[INFO] Initializing environment for https://github.com/python/black.
[INFO] Initializing environment for https://github.com/fsfe/reuse-tool.
[INFO] Initializing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Initializing environment for https://github.com/pycqa/pylint.
[INFO] Installing environment for https://github.com/python/black.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/fsfe/reuse-tool.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pre-commit/pre-commit-hooks.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
[INFO] Installing environment for https://github.com/pycqa/pylint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Error: black....................................................................Failed
- hook id: black
- files were modified by this hook
Error: reformatted adafruit_wiznet5k/adafruit_wiznet5k_dhcp.py
All done! โจ ๐ฐ โจ
That's a transcript of the error log, showing what I think caused the failure, taken directly from the page cited above.
This seems to be a formatting issue from python black. I think you can run this locally and check in the changes.
tyvm - will check it out.
Installed latest version of GIT on WSL. Cloned a repo. How does GIT know it's me wanting to make changes? I only input the username and email, it doesn't check for a password?
Feel like I've only cloned a repo and not initiated some kind of login where I want to be able to make changes to things...
When you try to commit, you will get a warning. You can configure your info as follows:
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com
See https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup
To push to GitHub, you need a private token. So that is your "real" security.
This could be a personal access token or OAuth. See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token.
yes i've already setup the name and email in the config. how to add the token into it?
git remote set-url origin <token>@https://github.com/DJDevon3/My_Circuit_Python_Projects.git
fatal: not a git repository (or any of the parent directories): .git
Figured out WSL is pulling the Github login from Windows Credential Manager
Yeah. Totally depends on your tools and os.
I probably set that up when I first setup WSL and just forgot about it. :/
I use CLI. See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/about-authentication-to-github for all the things. ๐ตโ๐ซ
We could use some expert commentary here or over in https://github.com/adafruit/circuitpython/pull/7874 (supercedes https://github.com/adafruit/circuitpython/pull/7833).
The problem is that we initially approved and merged a large PR into CircuitPython that had some large .zip files in it (about the size of all the rest of the repo). Even if the pull request had been reverted, the large files would have remained in the history. I realized this after an hour or two and did a git reset --hard to remove the merge and then a force push. That was not great but I didn't see another way to remove the history.
There is now a new PR, but it has the addition and removal of the large files in it as part of the multiple comimts. We don't usually do squash merges (in fact they are currently disabled), so the addition and removal of the large files will still be in the history.
My understanding is that if I enabled squash merges temporarily and then squash-merged this PR, the large files would then not be part of the history. But I would like someone who knows this better than me to confirm or deny that. And if you have a better idea let us know. Also if you have a better idea of what we might have done initially to undo the large merge of 7833, we would be interested.
I'm not an expert, but it's not immediately obvious whether the hard reset was enough to remove the history. The git reflog would generally still know about those commits, so I think the .zips would still be in the repo somewhere.
devon@GARAGE:~/My_Circuit_Python_Projects$ git push --force My_Circuit_Python_Projects main
Username xxx
Password xxx
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/DJDevon3/My_Circuit_Python_Projects.git/'
``` at least i got it to finally ask for a password.
Git will ask for your GitHub username and password. When Git prompts you for your password, enter your personal access token.
hmm, yes, though I think it might get gc'd eventually. I did some fresh clones and it seemed to clone fast enough, but I didn't do a careful measurement. I'm not sure how to figure out if the .zips are in .git/ somewhere
That doesn't work either. The requested URL returned error: 403
The access token is ridiculously long. Does right clicking not work for pasting it in there?
@still iron If you install the gh CLI supplied by github, I think it will lead you through setting up good authentication.
So Ubuntu using git is different from the gh instructions?
man the rabbit hole just keeps going
getting authentication set up on Linux can be painful. There are some helpers in /usr/share/doc/git/contrib/credential that you can use. I use to use libsecret as decribed there, but I think there is an easier way now (that is, gh will set it up for you)
devon@GARAGE:~$ sudo apt install gh
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package gh
I think you need to use kill the ref and then use git gc -prune to rebuild the history. See https://www.baeldung.com/git-remove-file-commit-history for options.
I have only done this once. It is definitely a pain.
Thanks - I saw the second link already but not the first. Doing that cleanup at the moment is secondary to getting the PR to merge without re-adding the large files in the history. Does the squash merge make sense to you?
You may consider a tool like RepoSurgeon for doing things like that in a controlled/repeatable fashion http://www.catb.org/~esr/reposurgeon/
I am not 100% sure. The problem should only exist in the fork at this point. Would it be possible to do git reset --hard in the fork? And then redo those commits.
Sorry. This type of stuff makes my head hurt. ๐ตโ๐ซ
Also can you add .zip to the .gitignore for the future?
@fierce field I would try to prevent the history cleanup in the first place.
From what I am reading the squash merge will work.
I would destroy the fork and check it out again.
Do you mean the PR authors' fork, or did you mean clone? The PR authors own their own fork. They did the PR on their main, so yes, they may want to clean it up later.
any cleanup would eventually be done on adafruit/circuitpython. I will check on that later, after the squash merge
@night reef fyi ^^ start at 7:05am your time
I'd probably just leave the files
How large is "large"?
I did mean the PR author's fork. Technically the file only exists there and not in adafruit/circuitpython.
That isn't too large. When I had a similar issue, the file was several GB which slowed everyone's pulls.
Maybe like 50-100. So awful. But it has been a while.
We also did a shared repo with individual branches. Not the fork model. So, I think you are safe with the squash merge. And that file doesn't exist on a branch.
(I think)
thanks - yes, after I did the reset, there are no visible commits that have the large files. But they may be in the reflog. But I'll check on that later and clean that up as necessary (or wait and see if they age away; not sure if that's true of the reflog or not).
I don't think they ever go away.
Tried the hard way. Git command line and I just don't get along. Deleted the entire repo and recreated it. Problem solved.
large blobs (binaries or other non-code files) and the shear volume of messy commits, is a huge reason why I like squashing merges when pulling things into core open-source repos -- it allows you to prune the chaos out
๐ and i generate plenty of chaos on my own, as well
oh my, so much the SAME
@fierce field If you requested changes on a PR I submitted, do I have to do anything to mark the changes as complete on the PR, or is just pushing to my fork on github, and thence to the PR enough?
You can click "Resolve Conversation" on the GitHub page where all the comments are listed, if I commented on certain lines. If you disagree or made some other change, leave it unresolved, add a comment, and I'll do Resolve. It's not a big deal.