Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for matthewsnyderâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Edit | Post #292394 | Initial revision | — | 3 months ago |
Answer | — |
A: Turn all changes after latest origin/main into a branch I handle this with: 1. Create a new branch with same commits 2. Delete commits from main branch In the situation shown, if you do `git checkout -b newbranch` it will create a new branch with the same commits. You then switch back to `main` and get rid of the commits on it with `git reset HEAD2... (more) |
— | 3 months ago |
Comment | Post #292312 |
I asked this while thinking of https://software.codidact.com/comments/thread/9971#comment-25064 (more) |
— | 3 months ago |
Comment | Post #292287 |
@#53078 That's neat! Worth posting as an answer to https://software.codidact.com/posts/292312 IMO (more) |
— | 3 months ago |
Edit | Post #292312 | Initial revision | — | 3 months ago |
Question | — |
How can I git checkout the previous HEAD? After switching to a different branch, `git checkout -` can move me back to the branch I came from. This is handy for times when I wonder "wait, what was that last branch again?" But this does not work for everything situation when you switch from commit to another. It works for branches, but when... (more) |
— | 3 months ago |
Edit | Post #292311 | Initial revision | — | 3 months ago |
Question | — |
What actually is a pytest fixture? Pytest uses fixtures. Their docs explain what fixtures do: https://docs.pytest.org/en/stable/explanation/fixtures.html But what actually is a fixture? Is there a definition for it? Is this a term from computer science, or something pytest invented? (more) |
— | 3 months ago |
Comment | Post #292287 |
Thanks for the response. I'm pretty sure there is in fact a `git checkout -`, it works for me, although it might possibly be an alias I got from oh-my-zsh. It works analogous to `cd -`. However, I checked and although it can switch to the previous branch, it cannot switch to the previous HEAD before ... (more) |
— | 3 months ago |
Comment | Post #292275 |
Are you trying to run your whole server, and test the routes "realistically"? So for example if `/search` is supposed to do a DB query, will your test also set up that DB and check for a correct response? Or do you want to ignore Flask and its `@app.get` etc decorators, and only check that the method... (more) |
— | 3 months ago |
Comment | Post #292287 |
I generally agree with this answer and disagree with the downvotes, but I think saying that it will forget the last commit you were on seems a bit odd. The whole reason people run `git pull` is because they want to update their local files to match the remote. Of course it would change what commit yo... (more) |
— | 3 months ago |
Comment | Post #292287 |
Since the general pattern with git is that most CLI flags have a config equivalent (with matching name) this seems like an unnecessary tangent. If someone really wants to know, they can post a new question "How can I make git pull always do --ff-only?". (more) |
— | 3 months ago |
Comment | Post #292287 |
IMO in this context it's okay to assume the reader has heard of man pages, and even noticed the common idiom of identifying programs according to the title of their manual section. It makes no difference to say "git-pull(1)" or `git pull`.
That said, since you used `git pull` in your question, you... (more) |
— | 3 months ago |
Comment | Post #292286 |
The question seems answerable if you assume that the OP is asking for any danger. (more) |
— | 3 months ago |
Edit | Post #292250 | Initial revision | — | 3 months ago |
Answer | — |
A: Reusing HTML without rewriting it I agree with other answers that a static site generator is the best approach. This is something that the original designers of HTML left as an open problem. The problem has now been "solved" by third party tools, and there's not yet a good alternative to HTML. Static site generators are those tools. ... (more) |
— | 3 months ago |
Comment | Post #292219 |
I personally feel like a lot of this is security theater to greater or lesser extent, but your reasoning that "untrusted code shouldn't be running" isn't exactly accurate. It is possible that this is intended as a "forward security", so that the concern is your library X is used by trusted program Y,... (more) |
— | 3 months ago |
Comment | Post #292151 |
I think your example about writing is a great point. I was thinking that if there are multiple places to ask git questions, then every time you ask a new one, you have to *think* about which one it goes in. However, actually it becomes obvious if you remember context. "git in the context of writing" ... (more) |
— | 4 months ago |
Edit | Post #292136 | Initial revision | — | 4 months ago |
Question | — |
After git fetch, how to fast forward my branch? I did `git fetch` to quickly get latest commits. I did this instead of `git pull` so I could deal with merge conflicts offline. But my repository is still stuck on the old commit, and now `git pull` fails because I can no longer connect to the internet. How do I "activate" the changes that I fetched?... (more) |
— | 4 months ago |
Comment | Post #292135 |
I posted this to document the current situation.
I actually wonder if it would be better to migrate all the git questions to poweruser, because they are about the use of a program and not coding. (more) |
— | 4 months ago |
Edit | Post #292135 | Initial revision | — | 4 months ago |
Answer | — |
A: Where should I ask git questions? Questions about Git should be asked in Software Development. This is a case of bringing the question to the experts. Git is a general purpose version control system, that can be used to version any type file, not just code. However, it is very popular with programmers, and many features were desig... (more) |
— | 4 months ago |
Edit | Post #292134 | Initial revision | — | 4 months ago |
Question | — |
Where should I ask git questions? Where should I ask questions about Git? (more) |
— | 4 months ago |
Comment | Post #292063 |
Since the comments have been cleaned up, I can now respond as follows:
Doing low-level arithmetic with the character codes might indeed be slightly faster. However, since the speed up is only a constant factor and does not affect algorithmic complexity I personally find it uninteresting here. I th... (more) |
— | 4 months ago |
Edit | Post #292063 |
Post edited: |
— | 4 months ago |
Edit | Post #292063 |
Post edited: |
— | 4 months ago |
Comment | Post #292061 |
Ah, so just 1k lines, ~15 chars each? I guess that's so small it really doesn't matter how you do it. I thought they would have tried to trip up the regex solutions :) (more) |
— | 4 months ago |
Edit | Post #292063 | Initial revision | — | 4 months ago |
Answer | — |
A: Parsing numbers from a text file You don't need a regex for this. To find `first` you can simply iterate through the line until you find a digit. To find `second` you can do the same but in reverse. This is more efficient than running a regex. For a problem as small as the example, it doesn't matter and arguably the regex adds re... (more) |
— | 4 months ago |
Comment | Post #292061 |
Usually in AoC the example is of trivial size, but then the real problem input is much bigger. For this, you must have posted the example only. Can you add some information about how big you expect the real problem to be? (more) |
— | 4 months ago |
Comment | Post #291977 |
Yes, I do use bat. But, in this case, I want to highlight output from my own Python program. If there's a way to use bat from inside Python, that would solve it. `python my_script.py | bat` wouldn't work though, it's an interactive program. (more) |
— | 4 months ago |
Edit | Post #291975 |
Post edited: |
— | 4 months ago |
Edit | Post #291975 |
Post edited: |
— | 4 months ago |
Comment | Post #291969 |
Sounds like you want to say "combining" :)
However, a technical detail in git is that if you literally want "two branches to become one", I think you really have no choice than `git merge`. `git rebase` etc. will not actually *combine* the branches, they copy changes from one branch to the other. ... (more) |
— | 4 months ago |
Comment | Post #291978 |
Maybe I was too coy in relying on the tag alone :)
Bat is a great pointer - I guess it can stream so it must be possible. But it wouldn't work for me directly, unless you know a way to use bat as a Python library. I think that if I simply run bat through subprocess the colors won't show up... Or w... (more) |
— | 4 months ago |
Comment | Post #291980 |
My own guess was also that you have to buffer. Safest is probably to flush the buffer on blank lines - there seems to be little syntax whether Markdown or code that transcends a blank line, and it wouldn't be a great loss if that was incorrectly highlighted.
If the paragraph takes too long, probab... (more) |
— | 4 months ago |
Edit | Post #291976 | Initial revision | — | 4 months ago |
Question | — |
How to format Markdown in terminal When printing Markdown text to the terminal, how can I get a bit more formatting so it looks nicer? I realize that this is a bit of a contradiction, since terminals generally use only one font. But kids these days have come up with all sorts of terminal bling, and you can do things like bold, ital... (more) |
— | 4 months ago |
Edit | Post #291975 | Initial revision | — | 4 months ago |
Question | — |
Can you have syntax highlighting for streaming text in Python? Suppose you have a situation where text is coming 1 word at a time, and you want to quickly show it to the user. "Quickly" is not in the sense of a performance constraint, but rather we don't want to wait until the end of the stream to apply highlighting as that would take too long. The rate is somew... (more) |
— | 4 months ago |
Comment | Post #291969 |
When you say "merge", do you mean as in "git merge" or just generally "combining changes"? (more) |
— | 4 months ago |
Comment | Post #291972 |
That, and `--interactive` is very nice on the rare occasions that justify it for me. I really wish all these Githubs would add an interactive rebase UI for the PRs, it would be so useful. (more) |
— | 4 months ago |
Edit | Post #291972 | Initial revision | — | 4 months ago |
Answer | — |
A: What is the general process for merging two git branches, reviewing edits on each branch? For completeness, I'll add some more obscure ways: If your goal is to simply move some changes from one branch to another, you can also use `git rebase` and `git cherry-pick`. These give you more control over what exactly you are moving. For example, `git rebase` has an interactive mode where you ... (more) |
— | 4 months ago |
Comment | Post #291970 |
Well, your question has in the title "how do I merge two git branches" - it's not surprising that people would assume you want `git-merge`.
(more) |
— | 4 months ago |
Edit | Post #291888 |
Post edited: |
— | 4 months ago |
Comment | Post #291970 |
"Incompatible" means this: Say you have file X which on line Y says `foo`. Branch A wants to change this to `bar`. Branch B wants to change it to `baz`. Who wins? Git will probably ask you to manually resolve it.
>process for reviewing edits one by one and approving them or not
I don't think gi... (more) |
— | 4 months ago |
Comment | Post #291970 |
Making the integration branch is a great idea, especially when you have complex and divergent branches. In principle, you can just directly merge one branch to the other, but if the branches diverged a lot it can easily create a mess. The intermediate integration branch allows more control and oversi... (more) |
— | 4 months ago |