uploading to github
so i have file and i want to upload it to github and i try to use commands only with cmder to get used to that but after i push it say they are different commit
47 Replies
try to change the commit and now it has errors
Did you try to
git pull
the upstream changes to your local machine?i'm relatively new to git and github still learning so i'll just show you what i get lol
the repository is new and empty btw
normally you have to
git push origin main
(or master
, depending on what your main branch is called)this is what i get rn
git pull origin main
?Brutal…
did i do something wrong and broke it?
And you're 100% sure the github repo is empty?
was trying to push to master then realized it's new branch
Ok, so not empty. Do you have that readme in your local copy?
Oh, you have both
main
and master
?i don't
i'm trying to send pic
try
git pull remote master
then. Maybe you're synced to the master branch and not the main branch
Yeah, Discord is being slow right nowwait i will just delete the git file and redo it with new repository
Honestly, I'd suggest deleting the github repo and making a new, empty directory
Delete the
.git
…yeah, you got it 😜i was researching that for like an hour lol
Git is very powerful, but with great power comes great easy of fucking up lol
For git, the rule of thumb is to only make changes in one place at a time, either locally or on the remote (github). If you do work on multiple computers then be sure to push all changes from one machine before leaving it so you can pull from the other if you need to. That way everything stays synced.
yah and i know i'll need it to be a dev as well
I'VE DONE IT !
It takes a long time to get it right. Heck, I tend to use VS Code's git integration because it's less error prone
turn out if i don't add readme file they give you step by step how to upload
is that plugin ? can you send video explaining how to use it
It's part of VS code as far as I know
is there a way to automatically make the branch name to main to not face this issue again?
Is it not main by default? Thought they made that change a long while ago
every time i use git init it makes it master
and being newbie get confused with all the commands
One thing you can do is to rename the branch in GitHub before pushing your local code to it
But if you've already pushed your code you can do
git branch -m master main
it's already main now before i pushed it
-m
means "move" so it'll "move" your current branch (master) to the new branch (main). Be sure to git push origin main
after the move commandwhat about the -u
-u
is "set upstream"
https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--ultupstreamgtoh got it !
thank you for the help !
Honestly I know just enough git to know what commands I should be using and consult the docs
It's also how I do most HTML, CSS, and JS :p
🤫
Don't tell anyone, reading docs is my superpower
i can't do that, i got plugin that read the page for me lol
sounds rough
Idk if this would work in the future but you could have maybe done
git reset --hard
to reset to the last commit
I don't think that would have pulled a file you don't have though 🤔 but it's a command I've used a lot of times when git pull origin master
refuses to workwill try it next time !
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View
Yes after learning more about git and github I start uploading and I'm pretty sure I was doing it with wrong branch so the fix was to do "git branch -m main" to switch the branch to main because it was being uploaded to a branch name master