Updating a Github Repository

  • Thread starter Thread starter godreborn
  • Start date Start date
  • Views Views 1,715
  • Replies Replies 15

godreborn

Welcome to the Machine
Member
Joined
Oct 10, 2009
Messages
38,464
Solutions
14
Reaction score
24,175
Trophies
3
XP
29,465
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?
 
  • Like
Reactions: godreborn
  • Like
Reactions: Kazesama
  • Like
Reactions: godreborn
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?
 
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
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
I'm still confused about the difference between git pull and git fetch. what if I want to download a specific commit?
 
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
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
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