#đź”’ How to work Github?

143 messages · Page 1 of 1 (latest)

coarse hinge
#

Hi! I have been stuck in the hospital for a week, so took the time to make a simple game (admittedly with the help of chat gpt, but typed and debugged everything myself as I feel like that’d help my memory rather than copy and paste)

I made a github account and want to upload my project to get comments from people who know better than I do regarding it, but I can’t figure out how to do so. Would anyone be able to tell me how to do that and possibly review the code?

I annotated as I went to try to get a better understanding of anything new to me (again, with the help of chatgpt so possible that some info is incorrect, so please let me know)

It’s just a small maze game that’s meant to enhance critical thinking, randomly hitting a door that a question has to be correctly answered to get through.

cunning gardenBOT
#

@coarse hinge

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

elder pond
#

You can use Github just as a place to upload your code but I really recommend learning how to use it as part of your programming workflow

#

Having said that there is an "Add file" button you can use on the repository main page to upload files directly

#

although bear in mind that tutorial assumes you're used to using the command line, you might need different sources if you don't want to learn to use it right now

#

I might be able to point you to better resources if you describe how you write code

vagrant current
meager mirage
#

@coarse hinge

#

what editor are you using?

coarse hinge
coarse hinge
meager mirage
#

IDLE?

meager mirage
coarse hinge
#

Yeah, came with Python 3.13

coarse hinge
meager mirage
#

go to the cmd

elder pond
coarse hinge
meager mirage
coarse hinge
elder pond
#

it should be near the top of the page

vagrant current
#

winkey+r, type cmd, hit enter

coarse hinge
#

Ohh, I thought that was something specifically to do on github so I didn’t even consider windows cmd

vagrant current
#

did you install git?

coarse hinge
#

If it’s into windows cmd, no

#

is it a pip install?

meager mirage
vagrant current
#

nope

vagrant current
meager mirage
coarse hinge
meager mirage
#

oh wait it is that

#

both work

#

gitforwindows is recomended by github

#

so use that

coarse hinge
#

Ok

meager mirage
coarse hinge
#

Downloading now. Hospital wifi is balls lol

meager mirage
#

ok ping me when done

coarse hinge
wintry stratus
meager mirage
coarse hinge
#

Should I allow git bash profile to win terminal?

meager mirage
coarse hinge
#

Ok

#

VIM as default editor? Never heard of that but have used notepad++ and that is an option

coarse hinge
wintry stratus
#

great time to learn now then

meager mirage
#

you should have told me

#

theres an extension in vscode that you can do easily

coarse hinge
#

I’m a newbie lol. I’ve done random small things with python and html, but never a full on project

wintry stratus
#

vscode will help you a lot more then notepad++ when writing python code

meager mirage
#

and vscode is good

coarse hinge
#

Went through codecademy Python course but book learning is my absolute worst way of learning, so I decided fk this and just started doing stuff

wintry stratus
meager mirage
coarse hinge
#

Really? Feel like both notepad++ and idle have been pretty simple to use

wintry stratus
meager mirage
wintry stratus
#

yeah, i agree, vscode isn't that much more complicated then notepad++ when you have gotten the hang of some basic things

coarse hinge
#

Wait, did we ever decide whether to leave vim as the default editor lol

wintry stratus
wintry stratus
coarse hinge
#

The notes say might be better t use a more modern one

meager mirage
wintry stratus
#

vim is not very user friendly for new users
even though as a long time linux user i prefer vim in many cases

coarse hinge
#

Finished installing git

#

Assume now is when I go to command prompt and follow the repository code on github?

meager mirage
coarse hinge
meager mirage
coarse hinge
#

There now

meager mirage
#

and its the folder that has you .py file

coarse hinge
#

Yup

meager mirage
#

now type git init

coarse hinge
#

Initialized empty

#

Oh, this is where I follow the github layout?

meager mirage
#

do the commands where it says .....or push an existing repository

coarse hinge
#

Ok

meager mirage
#

and paste the output here

coarse hinge
#

error: src refspec main does not match any
error: failed to push some refs to “address”

#

After doing the git push -u

vagrant current
# coarse hinge

You can use discord in Chrome, that way you don't have to keep taking photos with your phone

coarse hinge
meager mirage
#

did you do the first command?

coarse hinge
#

Yeah

meager mirage
#

do git push then

coarse hinge
#

Do this upstream thing?

meager mirage
#

type git push

#

try it

coarse hinge
#

I did, that resulted in that bottom part

meager mirage
#

hmm 1 min

#

do this git add .

coarse hinge
#

then push?

vagrant current
#

gotta commit too

meager mirage
#

yea i know

meager mirage
coarse hinge
#

Same result. Maybe I should be doing the create new repository thing?

meager mirage
#

no

#

do this git commit -m "Your descriptive commit message here"

#

and then do this git push origin main

coarse hinge
#

Maybe I’m an idiot lol

meager mirage
#

why?

coarse hinge
meager mirage
#

oh youur not logged in into git

#

git needs that so it can tell who did the commits

coarse hinge
#

Should I follow those config lines or launch git somewhere?

meager mirage
#

confirm by running this
git config --global user.name

#

and then run the commands on github(all of them)

coarse hinge
#

Ok, my project is in the home screen now!

#

Jesus that felt like a lot lol

meager mirage
#

haha nice now can you close the tread by doing !close

#

and

#

you can also do this if you have other projects

coarse hinge
#

I’d just do the git push for each particular project? Or would I save in same folder and it would just replace the ones that already exist?

meager mirage
#

do git push

#

@coarse hinge

azure flower
#

Apologies if this is confusing but ive kinda tried to explain how you would used git for working on a project but im half asleep atm đź«  ill add below common git concepts and hopefully it will clear some of this up

a common way to work with git in the future is to start with the empty git init if its a new project, otherwise git clone + [github repository url].git for a local version of the github copy

  • Frequency check for updates if others are also collaborating on a project: git fetch or git fetch --set-upstream origin main if first fetch
  • Check the status of your work vs the fetched result: git status
  • if the results say that your work is behind the remote (i.e, github copy): git pull
  • Every time you add a new feature: git add . && git stage .
  • When your ready to commit to the feature: git commit -m "your thoughtful description"
    — note this will only add to your local version until you push it but adds a clear debuggable history
  • To move those changes into your github: git push
azure flower
#

Common Git Concepts/Terminology

  • Branch: Branch: A branch is a separate line of development within the same codebase. It allows you to work on updates or features without affecting the main code. Typically, you'll have a "main" or "master" branch, along with additional branches for specific features, bug fixes, or updates.

  • Remote: A remote is a version of your repository hosted elsewhere, often on platforms like GitHub. It allows you to collaborate and back up work.

  • Fetch: Retrieves updates from the remote repository and tells you what changes are available, but does not apply them to your local code.

  • Pull: Combines fetch and merge. It downloads changes from the remote and updates your local branch with them.

  • Merge: Integrates changes from one branch into another. If two branches modify the same code, a conflict may occur, which must be resolved manually.

  • Commit: A saved snapshot of your changes with a message describing what was done. It's like creating a checkpoint in your project.

  • "Push:" Sends your committed changes from your local repository to the remote repository, making them visible to others.

#

@coarse hinge I hope that helps you understand how Git works a bit more

coarse hinge
azure flower
#

No worries 👍

coarse hinge
#

!close

cunning gardenBOT
#
Python help channel closed with !close

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.