Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make git commands work #244

Merged
merged 5 commits into from
Aug 19, 2024
Merged

fix: make git commands work #244

merged 5 commits into from
Aug 19, 2024

Conversation

Saransh-cpp
Copy link
Member

@Saransh-cpp Saransh-cpp commented Aug 13, 2024

Closes #243

Copy link
Member

@dpshelio dpshelio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When did the -a stopped working for needing to do the add first? In any case, I prefer that way and though this will be done, let's fix the rest to remove the -a from all the commits 😁

ch00git/05Collaboration.ipynb.py Outdated Show resolved Hide resolved
@@ -354,7 +359,7 @@
# Now commit the merged result:

# %% jupyter={"outputs_hidden": false} language="bash"
# git commit -a --no-edit # I added a No-edit for this non-interactive session. You can edit the commit if you like.
# git commit -a --amend --no-edit # I added a No-edit for this non-interactive session. You can edit the commit if you like.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need the amend here? Shouldn't need to, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll either need amend or provide a commit message. I thought omitting the commit message was intentional. I usually commit my conflict resolves with "Resolve conflict" message; maybe I should do that here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But git provides a default git message when creating a merge commit. Has git changed the default of merges that may not be trying a merge commit but something else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, that is the case only when there are no conflicts. I might be wrong here, but I think the default message is provided when the merge is possible without conflicts (and there is no fast forwarding). Is this the case or was it different at the time of writing the course?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my new installed laptop without any configuration beyond author name it does create the message

https://asciinema.org/a/5xpZElfdDxq8rsze1rHEHSBRp

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. I had no idea this was possible, thanks! The command in the course is failing because it is not generating conflicts at all. Would it be possible to add ➕ me to https://github.com/UCL/github-example as well? It is a bit hard to work on the git pages locally, given that all push/pull commands fail because of access issues 😨

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You've got access now... but I don't think you need it. Without looking into it in detail, I wonder if the problem is produce because git now requires setting the default action when pulling.

Copy link
Member Author

@Saransh-cpp Saransh-cpp Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git can really make you scratch your head sometimes. Turns out, the github-example repository had a legacy master branch (which was set as default), so whenever the lesson cloned the repo, it automatically used the master branch. But the lessons where we create a git repo locally, git uses the main branch. The conflicts did not show up because the commits were on 2 different branches.

Everything looks good now! 🫠

ch00git/11Miscellany.ipynb.py Outdated Show resolved Hide resolved
@Saransh-cpp Saransh-cpp force-pushed the saransh/git-commands branch from f37c5e2 to a471e94 Compare August 14, 2024 15:08
@Saransh-cpp
Copy link
Member Author

Saransh-cpp commented Aug 14, 2024

When did the -a stopped working for needing to do the add first?

This is confusing to me as well. For some reason, git is considering %%writefile as removing the existing file and writing a new file with the same name. -a then does not work on untracked changes and the commit command errors out.

Lancelot the Brave and others added 3 commits August 15, 2024 16:31
Co-authored-by: David Pérez-Suárez <d.perez-suarez@ucl.ac.uk>
@Saransh-cpp Saransh-cpp force-pushed the saransh/git-commands branch 2 times, most recently from 3c34915 to 614c32c Compare August 19, 2024 13:52
@Saransh-cpp Saransh-cpp force-pushed the saransh/git-commands branch from b8ccc24 to 4b12a2c Compare August 19, 2024 13:57
Copy link
Member

@dpshelio dpshelio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing!

@dpshelio dpshelio merged commit 8493054 into main Aug 19, 2024
5 checks passed
@dpshelio dpshelio deleted the saransh/git-commands branch August 19, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

git commands error out in some pages
2 participants