Thread: Using Github
View Single Post
Old November 1, 2018, 14:08   #3
Join Date: Mar 2016
Posts: 293
Quirk is on a distinguished road
So, git has lots of documentation all over the web but it can be a bit detail heavy. I'll try to provide a brief overview on this push pull thing.

Git works off the idea you have a "repository" with the whole history of the source code on a machine, and lets you sync it with other machines and their repositories.

So if you go to your repository and type
git checkout master
You get your local master branch and all its known history which you can check with a git log or gitk or whatever.

If you want to get the latest changes from the repo you cloned from type
git pull
and it will pull in all the latest changes and update your branch. If you have your own commits on master it will merge them in.

So now you're up to date, you change some files, do a git add -u to add all your updates, then type git commit and write a comment. If vim worries you you can also type git commit -m "my comment" and write a short command line comment.

Then to upload your commit back to master you type git push.

If you have your own branch it's the same process to update it with github except your first push may need a set-upstream flag to tell git to create the branch in the other repo - if you need to do this git will tell you and show you the syntax.

Getting changes from master into your branch is a case of being in your branch (git checkout my branch); type git branch to check you're in the right branch then
git merge master

This merges changes from master into your current branch.

Selective changes are more tricky and may mean cherry picking commits.

Hope this helps.
Quirk is offline   Reply With Quote