#github
1 messages ยท Page 1 of 1 (latest)
<@&987246964494204979> please have a look, thanks.
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
since ur not using the command line but click some IDE buttons, please show us exactly what ur doing
also post the link to the repo as text please
okay, the link to the repo please
so u want to update ur master branch with a commit u made locally?
This error usually happens when you create two unrelated repo and try to push one into the other @wooden abyss
yes
and thats the case here as well
ur online repo seems completely unrelated
it has a main branch
and a readme commit
but ur intellij thing is completely different
it has a master branch and 2 commits called "commit"
@chrome barn what do u want to happen?
are u sure this is the right repo?
I want to store my files on github
yeah but ur github repo is at a completely different state
do u want to delete whats on github right now and replace it with ur stuff instead?
except the readme file
oh okay
and u need to force-push
I thought it would pull the readme file
u just said u want the opposite
Im watching a video at linked in learning
u said u want to delete the readme file and replace it with what u have locally
what do u want to do?
I want to sync it
u cant sync two histories that are completely unrelated
ok let me finish watching the vidfeo
also, ur branches are incorrectly named
the one on ur github is called main
in intellij u called it master
i doubt ur video wanted u to do that
id suggest u first push ur code
to master
not main
then u manually copy the readme file into ur intellij and push it as well
then u delete the main branch on github
ay ay captain
and go into the settings to tell it to use master as default branch
I think its because I was following another tutorial and changed the git settings
and then I went onto this video
You can
You can ask git to basically put your commits on top of the unrelated commits, similarly to a rebase, it's just a flag
Do you really want to erase what is in github?
its my first time using github and I have the code backed up already in a zip file
You can simply do git pull --allow-unrelated-histories
If you want to keep both what is on github and what is in local
s*
I dont remember what I did earlier because I was following a different tutorial
is there a way I can delete everything and redo it?
Then delete the project and redo it
But there is no need to do thay
I would guess the master being the one because its the only local
should I try main instead?
Im looking at the first tutorial I did
I used git clone
and then git branch --all
git branch mybranch
git checkout mybranch
idk if that matters
Ah my bad
i really would not recommend mixing the branches
its easier to get rid of main and push master
You need to specify the remote
but that was for another repo
its not a good idea to have master linked to main
OPs local branch is master
githubs branch is main
and they have unrelated histories
Huh
Unrelated histories isn't a problem
But different branches yes
yeah, but they are not really worth saving anyways
its literally just a single readme file
the readme file doesnt have anything to do with my code
its just a readme file that the tutorial told me to make
but u want it. im saying its easier to just copy pasta it
instead of trying to tell git to merge the branches together
u have to clean up ur branch mess
- copy pasta the readme file into ur master branch locally
- push ur master branch
- github settings > set master as default branch
- github > delete main branch
that takes just a few seconds if u know where to click
so stick with me and tell me if ur stuck
how do I copy and paste the readme file?
go to ur github website
click the file
download it. or click on "raw" and copy the content
then create the file in ur intellij
this has nothing to do with git-magic
its just making a new ordinary file on ur operating system
yes
and put the content in there that u want to save
cause we will delete main and hence everything in that git repository online
so the old readme is gone then
ok I created the readme file
right on the first page
where it says default branch
select master
instead of main
now click here on the main page: https://i.imgur.com/WduPWeN.png
ull find a ๐ฎ icon next to the branches
delete main?
yes. delete main
if u now go on ur main page of the repo, it should show master and all ur code + readme and everything is fine, right?
ah the readme is still missing
make a commit and push
in intellij
its in the src folder
yeah but u havent uploaded it yet
its not on github
only in intellij
so u have to create a commit and then push that commit
oh okay its there now
๐
cool thanks
what do u mean "backup"?
like when I am working on my project and I mess up and cant redo the code and I want to get to a previous version of my project
u just use git revert
or checkout a previous commit
all ur code and the full history is on github, online. u cant lose anything anymore
not sure how it works in the intellij ui. but i guess u would just click on a commit in the history graph and then right click checkout
or right click revert
sth like that
oh I see
so if u want to go back, u just click there
better delete that it has my email
so if u now right click for example the commit 49 minutes ago
it should show sth like revert
if I revert
can I undo the revert?
as long as u dont git push -f (force push), u dont lose anything
okay
if u just want to experiment temporarily, create a new branch
this is so cool
u should get into the habit of master being the final version
so commit and push creates it in the git hub?
commit creates "units of changes" and push then uploads all ur new commits
and pull gets it from the github?
yes, pull downloads all new commits
yeah my friends were using github and i thought it would be necessary for me to use it as well
they were using command line though
if ur a programmer, its a must at some point
latest in job
there is no programmer job that doesnt use git
well git is not too complicated
until u run into complex situations, yeah
oh
wait until u have to resolve ur first merge conflicts ๐
but that doesnt happen unless ur working with others on the same project
dont worry though. juniors arent really expected to be good at git yet
many people learn that as they enter the job
barely anyone is good at git before being thrown into actual real projects with other colleagues
nice ๐
Im turning 41
but squid does not believe I am that old
well anyway I should get to sleep
gn
have a good one ๐
so the main three commands are commit, push, and pull?
not really, well if that's simpler for you