Updating a Github Repository

godreborn

Welcome to the Machine
OP
Member
Joined
Oct 10, 2009
Messages
38,470
Trophies
3
XP
29,190
Country
United States
do I just need to do a "git pull" to update the repository on my computer without having to delete, then re git clone a repository?
 

godreborn

Welcome to the Machine
OP
Member
Joined
Oct 10, 2009
Messages
38,470
Trophies
3
XP
29,190
Country
United States
  • Like
Reactions: Kazesama

Sypherone

Gaming Ninja
Member
GBAtemp Patron
Joined
Apr 28, 2019
Messages
1,659
Trophies
2
Age
44
XP
2,878
Country
Germany
  • Like
Reactions: godreborn

godreborn

Welcome to the Machine
OP
Member
Joined
Oct 10, 2009
Messages
38,470
Trophies
3
XP
29,190
Country
United States
let's say that the 3ds version of sm64 is updated on github, and I already have an earlier version of the source code on my computer, instead of deleting it and starting over, I could do something like git pull origin 3ds or main or whatever the branch is called, and it will update the necessary source code?
 

cherryduck

Well-Known Member
Member
Joined
Jul 1, 2007
Messages
331
Trophies
1
Age
35
Location
The far side of the moon
Website
Visit site
XP
1,629
Country
git checkout in the terminal and that's it? no adding in a branch or anything?

You use git checkout to switch branches, which requires you to specify the branch.

git pull updates the branch you have checked out.

Say I'm on the main branch and I want to switch to the 3ds branch:

git checkout 3ds
git pull

That's it, I'm now on the 3ds branch and it's up to date.
 
  • Like
Reactions: godreborn

godreborn

Welcome to the Machine
OP
Member
Joined
Oct 10, 2009
Messages
38,470
Trophies
3
XP
29,190
Country
United States
You use git checkout to switch branches, which requires you to specify the branch.

git pull updates the branch you have checked out.

Say I'm on the main branch and I want to switch to the 3ds branch:

git checkout 3ds
git pull

That's it, I'm now on the 3ds branch and it's up to date.
thank you, my friend. that makes sense now.
 
  • Like
Reactions: cherryduck

godreborn

Welcome to the Machine
OP
Member
Joined
Oct 10, 2009
Messages
38,470
Trophies
3
XP
29,190
Country
United States
I'm still confused about the difference between git pull and git fetch. what if I want to download a specific commit?
 

cherryduck

Well-Known Member
Member
Joined
Jul 1, 2007
Messages
331
Trophies
1
Age
35
Location
The far side of the moon
Website
Visit site
XP
1,629
Country
Fetch checks if there are any updates, pull actually pulls those updates. To pull a specific commit you use git checkout *commit hash*.

It's not recommended though because then you end up in a detached state, and generally speaking you want the latest code. I guess it doesn't matter quite so much if you're not making changes and pushing them to the source repo but it is messy and will put your local copy in a weird state.
 
  • Like
Reactions: godreborn

thominho

Active Member
Newcomer
Joined
Feb 9, 2014
Messages
41
Trophies
1
Age
29
XP
1,158
Country
Greece
The "normal" way is to fetch all changes using "git fetch --all" and then update only the branches that you want to update to prevent conflicts with other branches of yours. Conflicts usually happen when you change a file that someone has made changes.

But the novice commands are:
git clone -> Download Repo to your Computer
git log -> to search older commits and their unique number
git checkout [BRANCH_NAME] -> Change Repo to the specified branch or change to a commit using the unique number
git pull -> Update Repo to your Computer to the latest changes
git add -> add changes
git commit -> persist locally changes with a message
git push -> send the persisted changes locally to online to allow others to see these changes
 
  • Like
Reactions: godreborn

9x0

Member
Newcomer
Joined
Jul 18, 2021
Messages
12
Trophies
0
XP
108
Country
Switzerland
The "normal" way is to fetch all changes using "git fetch --all" and then update only the branches that you want to update to prevent conflicts with other branches of yours. Conflicts usually happen when you change a file that someone has made changes.

But the novice commands are:
git clone -> Download Repo to your Computer
git log -> to search older commits and their unique number
git checkout [BRANCH_NAME] -> Change Repo to the specified branch or change to a commit using the unique number
git pull -> Update Repo to your Computer to the latest changes
git add -> add changes
git commit -> persist locally changes with a message
git push -> send the persisted changes locally to online to allow others to see these changes
Adding to novice commands, git status -> lists "staged" changes
Useful to check before git commit
Rework of novice commands are:
git clone -> Download Repo to your Computer
git log -> to search older commits and their unique number
git checkout [BRANCH_NAME] -> Change Repo to the specified branch or change to a commit using the unique number
git pull -> Update Repo to your Computer to the latest changes
git add -> add or "stages" changes
git status -> lists "staged" changes
git commit -> persist locally changes with a message
git push -> send the persisted changes locally to online to allow others to see these changes
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • S @ salazarcosplay:
    or have it that you don't know you are a cyborg, robot, and you find out and have a existential crisis
  • S @ salazarcosplay:
    or have it start in the virtual world and you are an ai that gained sentience
  • Xdqwerty @ Xdqwerty:
    btw gonna wash my face in a bit, my eyes feel tired
  • S @ salazarcosplay:
    and you convince your owner to help you break out of the virtual world to real world
  • BigOnYa @ BigOnYa:
    Eyes - "yawn"
    +1
  • S @ salazarcosplay:
    you bleack in to goverment computer systems to get cyborg schematics so you can get a robot body constructed
  • Xdqwerty @ Xdqwerty:
    btw @BigOnYa the health bar doesnt decrease when i take damage (and yes i put the "at the beggining of the scene change value of greenflatbar: set to Protagonistcopmode.Health::Health())
  • S @ salazarcosplay:
    i the protagonist
  • S @ salazarcosplay:
    human, robot, cyborg
  • S @ salazarcosplay:
    human with cyborg enhancements
  • S @ salazarcosplay:
    or like terminatior
  • S @ salazarcosplay:
    with living tissue
  • BigOnYa @ BigOnYa:
    @Xdqwerty there is health behaviour you can add to your character, then to use a health bar is lil more complicated, google n watch a few tutorial video on it, be too hard to explain here.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, the character has the health behavior
  • BigOnYa @ BigOnYa:
    I know you have to create a health and health max variable. Then there is a calculation you use in code to subtract width size of the health bar. Google few vids.
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, the "greenflatbar" is one of the preset health bars btw
  • BigOnYa @ BigOnYa:
    Yea you can use any bar/sprite. It will just change the width. Ok good luck and have fun. I'm off to go shoot some pool at the bar. Talk to you later.
    +1
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, why does the health behavior exist if you can just use a variable?
  • Xdqwerty @ Xdqwerty:
    and nope the number still doesnt change
  • Xdqwerty @ Xdqwerty:
    ok im gonna make my own asset
  • Xdqwerty @ Xdqwerty:
    nvm i think i fixed it
  • Xdqwerty @ Xdqwerty:
    @BigOnYa, I fixed it
    Xdqwerty @ Xdqwerty: https://www.youtube.com/watch?v=EkjpCNa6vlY