#git
1 messages · Page 1 of 1 (latest)
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
so this is after creating three commits, each of which creates one file
yes
this is after checking out the "Add bar" commit
the history behind "Add bar" continues to exist
yes
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.
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
I don't know if GitHub Desktop lets you do that. It expects you to revert commits that you don't want, rather than rewriting history or sending branches back to an older commit
also, the commit still exists; Git will not get rid of it for a while
it's simply an orphan, with nothing pointing to it
but then whats the point of it
whats the point of reverting a commit if that revert gets undone anyway?
you did not "revert a commit"
i know
a revert is a commit that cancels out the changes another commit made
because you didn't change where main is pointing
but what would be the point of doing anything in that orphan state
if you don't eventually reference the commit, there is no point
what if I want to make main point to that orphan branch
that's easy enough to do on the command line
i don't know about doing that in GitHub Desktop
hold up
I think I got it
you can create a new branch when inside that orphan state
indeed, and I guess you could do a shuffle
make new branch, delete main, rename new branch to main
git checkout main
git reset --hard desired_commit_hash
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
if I wanted to put master back onto "Add baz", I'd do git reset --hard 591d767a48
that's called the remote repository
its that fucking scary
well yea
true
altho for some reason unity doesnt let me use it
use what?
every time I want to publish to Github it gives me an error
you mean GitHub Desktop is giving you an error?
or is there some kind of add-on for unity too
You have changed where main points
oh it's just not responding
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
a timeout indicates that the server didn't respond
you would get an error if you were trying to push excessively large files
although that shouldn't make it balk at you: you haven't actually rewritten history
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
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
perhaps it's configured wrongly
it lets me upload other repositories
I followed a guide step by step on how to do it
from the command line, you can ask for the remote repo with
i think it was brackeys
and what does it tell you?
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
yea it was the issue
yea so it points to the correct site
should I do a git push -u origin main
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
its a url
hm, not sure why you'd be getting a timeout then
If you created a new branch and deleted the old main, you'll definitely need to do this
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"
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
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
5 times in a row?
meaning that something is screwed up between you and GitHub, yes
If there's a specific commit from main you want to keep, you can cherry-pick it later
cherry-picking pulls specific commits over from somewhere else (without merging in everything leading up to those commits)
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
You can compare across branches.
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
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
so you lumped a bunch of changes into a single commit?
or do you have some untracked files in your repository?
yeah...
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
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
technically I can also just copy paste