Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a local copy of a GitHub repo, track changes and push updates back to the remote

Tags:

git

github

I have a repo on GitHub and I want to update it with changes made to the folder I pulled it from.

What are the steps, without jargon or short hand terms, a new Git user should do from the moment they cd directory?

Including how to track the local changes made to any files and then how to send those changes and updates back to the remote repository.

like image 256
Elmo Avatar asked Dec 04 '22 18:12

Elmo


2 Answers

The most simple flow is this:

# clone the repository (from github, for example)
git clone [email protected]:username/reponame.git
cd reponame    

# edit some files

# add them to the index
git add file1.txt
git add file2.gif

# review your changes
git status    

# commit the changes
git commit -m "Decription of my change"

# push them back to the remote repository
git push origin master

This is the basic flow that should get you going. However, there's lots of resources for learning the basics of git, I highly recommend you go over them. Getting started is really not that difficult as it seems.

like image 140
Yuval Adam Avatar answered Dec 08 '22 01:12

Yuval Adam


You're working alone, I infer, so it is very simple.

1) is done by "git clone" through SSH. The github website will give you the clone URL.
2) Just work locally, that's what DVCS's are about :-) And "git commit" what you develop.
3) You need to "git push" your branch to github. It will then be fetchable by other people.

These are the basics, when you will get confident with this simplest workflow, you can learn many stuff that will suit your coding practices nicely, rewrite your history and lots of nice git stuff.
And you will learn how to work with other people, merge, and rebase.

like image 41
Tramboi Avatar answered Dec 08 '22 03:12

Tramboi