#git

1 messages · Page 1 of 1 (latest)

elfin island
#

git thread

green stump
#

i tried checkout multiple times

#

and its literally all it did

#

and I want to be able to be on a branch

#

because I want to continue making commits

#

without them being lost in a single click

elfin island
#

so this is after creating three commits, each of which creates one file

green stump
#

yes

elfin island
#

this is after checking out the "Add bar" commit

#

the history behind "Add bar" continues to exist

green stump
#

yes

elfin island
#

you don't see any commits past "Add bar" because the current commit is the most recent thing that exists

#

this is expected

#

"Add baz" did not go anywhere. It is still pointed to by the master branch.

green stump
#

i made the mistake of loading the initial commit here

#

thats my bad

#

yes

#

but you are now on a detached head

#

how do you make this detached head the main branch

#

or something

#

because if you were to add a new commit, and click on master, then that commit gets lost

#

no warning no nothing

#

also I realized that before committing that "bad commit" commit, I couldve just pressed "undo all changes" and it wouldve been fine

elfin island
elfin island
#

it's simply an orphan, with nothing pointing to it

green stump
#

but then whats the point of it

#

whats the point of reverting a commit if that revert gets undone anyway?

elfin island
#

you did not "revert a commit"

green stump
#

i know

elfin island
#

a revert is a commit that cancels out the changes another commit made

elfin island
green stump
#

but what would be the point of doing anything in that orphan state

elfin island
green stump
elfin island
#

i don't know about doing that in GitHub Desktop

green stump
#

hold up

#

I think I got it

#

you can create a new branch when inside that orphan state

elfin island
#

indeed, and I guess you could do a shuffle

#

make new branch, delete main, rename new branch to main

elfin island
#

if you don't know the hash of the commit you want, you can ask Git for every single commit it's aware of with

git log --reflog
#
* commit a750c100efc41cc0cf188af46eb338c3b2fb2388 (HEAD -> master)
| Author: Fen Dweller <chemicalcrux@gmail.com>
| Date:   Sat May 18 15:10:54 2024 -0500
|
|     Add buz
|
| * commit 591d767a487b5dc07b68e2b0b08db56882183d9d
|/  Author: Fen Dweller <chemicalcrux@gmail.com>
|   Date:   Sat May 18 15:00:52 2024 -0500
|
|       Add baz
|
* commit 708827f8279d88039c4d9600c0f4681021ca671e
| Author: Fen Dweller <chemicalcrux@gmail.com>
| Date:   Sat May 18 15:00:46 2024 -0500
|
|     Add bar
|
* commit 661a92c8f285253370c3b4235b13c4a5228d2dcd
  Author: Fen Dweller <chemicalcrux@gmail.com>
  Date:   Sat May 18 15:00:41 2024 -0500

      Add foo

This is the result of checking out "Add bar" and then making a new commit called "Add buz"

#

notice how "Add baz" is now dangling

#

It continues to exist, and will stick around until it gets garbage collected after a certain period of time

green stump
#

I got it

#

you can do it on desktop too

elfin island
green stump
#

but fuck is it scary

#

i want to create a github save of a github save bro

elfin island
#

that's called the remote repository

green stump
#

its that fucking scary

#

well yea

#

true

#

altho for some reason unity doesnt let me use it

elfin island
#

use what?

green stump
#

every time I want to publish to Github it gives me an error

elfin island
#

you mean GitHub Desktop is giving you an error?

#

or is there some kind of add-on for unity too

green stump
#

yeah

#

its just github

#

I tried using the console too

elfin island
#

You have changed where main points

green stump
#

it says a timeout

#

i didnt

elfin island
#

oh it's just not responding

green stump
#

basically

#

im thinking because its too big

#

but like

#

it timeouts in 1 minute

#

or less

#

and my internet is fine the whole way through

elfin island
#

a timeout indicates that the server didn't respond

#

you would get an error if you were trying to push excessively large files

green stump
#

ill try again

#

and show you the result if i can

elfin island
#

i.e. destroyed old commits and created new ones

#

you've just made a new commit based on an older one and pointed main at it

green stump
#

we're about to enter some 5D chess with interdimensional time travel kind of shit

#

also nono

#

I get that error every time

#

like even before doing this

#

i could never upload to the remote repo

elfin island
#

perhaps it's configured wrongly

green stump
#

it lets me upload other repositories

#

I followed a guide step by step on how to do it

elfin island
#

from the command line, you can ask for the remote repo with

green stump
#

i think it was brackeys

elfin island
#

get remote get-url origin

#

this will spit out the URL it tries to talk to

green stump
elfin island
#

oops, git

#

not get lol

#

typo'd

green stump
#

neither works

#

i tried git remote..... too

elfin island
#

and what does it tell you?

green stump
#

u can see there

#

altho i might just not be in any git repos

elfin island
#

oh, I see

#

you are not in the repository, yes

#

you need to be in the repository

#

Everything git does that isn't a --global config item is repository-specific

green stump
#

yea it was the issue

#

yea so it points to the correct site

#

should I do a git push -u origin main

elfin island
#

go to a repository that you have been able to push

#

and see if it also uses an https:// url, or if it's using SSH

green stump
#

its a url

elfin island
#

hm, not sure why you'd be getting a timeout then

elfin island
#

well, maybe: I don't know if Git will think the new main branch is literally the same thing as the old one

#

if not, it won't know which remote branch it corresponds to

#

that's what --set-upstream does: tells Git "our main goes with origin/main"

green stump
#

also fun fact the commit from this main had a fix for a bug and now im afraid to open it in case I lose all progress .:)

#

@elfin island there it is

#

it got stuck at like 13% while writing the objects

elfin island
#

if it managed to write objects for a while and then timed out, that suggests you've committed a ton of giant files

#

although

#

if it just got stuck, maybe the connection dropped

green stump
#

5 times in a row?

elfin island
#

meaning that something is screwed up between you and GitHub, yes

green stump
#

like I tried to do this at least 4 times before

#

and it always got stuck somewhere

elfin island
#

cherry-picking pulls specific commits over from somewhere else (without merging in everything leading up to those commits)

green stump
#

i just want to check what that file looks like on the main branch

#

i dont want to load the main branch I just want to view it

elfin island
#

You can compare across branches.

green stump
#

if that makes sense

#

that should work

#

idk how to tho

elfin island
#

switch to History and pick a branch to compare against

#

you will see changes between your branch and that branch

#

you could also just check out main

#

newmain will exist forever.

#

and it doesn't matter what wild things you do on main

green stump
#

ohh fuck no

#

i forgot to make a commit when I added state-based player behaviour

#

fuck...

#

yeaaa i want to copy over some files

elfin island
#

so you lumped a bunch of changes into a single commit?

#

or do you have some untracked files in your repository?

green stump
#

tho i always made sure to commit after every big change until now

#

like I even added a commit after changing a single ground texture until now bruh

elfin island
#

If you want to make it easier to reference both files at once, you can just check out your local repository again

#

then you can have two working trees (i.e. two sets of files)

#
git clone current_folder new_folder
#

you can then poke around wherever in new_folder's repository

green stump
#

technically I can also just copy paste

elfin island
#
crux@fens-mbp-2 anotherone % git remote get-url origin
/Users/crux/gittest

and this repository will actually point to the original repository!

#

copying also works :p

green stump
#

yeahh

#

fuck

#

its done

#

finally

#

lemme test it now

#

thank you for the help @elfin island !!

#

ur always the top one when it comes to helpin honestly