-1

I have a desktop PC and a laptop, I use both daily to commit to the same repository on GitHub (via Git). I have just moved over and started using Git, which is great. However, what command do I use when, for example, I have made changes on my desktop PC and committed them to GitHub, and then I want to move all of the changes currently on GitHub onto my laptop files to resume my work on my laptop where I left off on my desktop PC / GitHub?

Thanks in advance.

JamesTheHunt
  • 105
  • 1
  • 12
  • googling this sort of stuff would be quicker for an answer but i think what you're looking for is `git pull` on the laptop – L_Church Feb 19 '18 at 10:52
  • Possible duplicate of [Updating a local repository with changes from a Github repository](https://stackoverflow.com/questions/1443210/updating-a-local-repository-with-changes-from-a-github-repository) – phd Feb 19 '18 at 11:25

3 Answers3

2

Clone a repository into a new directory ;

git clone uri_repository.git

Incorporates changes from a remote repository into the current branch.

git pull 

Show the working tree status.

git status

Update the index using the current content found in the working tree.

git add .

Record changes to the repository.

git commit -m 'message'

Update remote references (refs) along with associated objects.

git push
acruma
  • 318
  • 2
  • 17
1

You can use the following command to syn your remote repository to your local repository

/* origin points to your remote repository, master is the branch in which your working */ 

git pull origin master

Incase you dont have remote ie origin setup then

/* Here your aliasing your remote repository location to origin, you can name it anything */

git remote add origin your_git_repo_url

In case if you dont know which branch your currently working then

/* This will list all the branches with * preceded which is active one */

git branch

Once you do your local changes then you may want to push the code to remote repository which can be done as follows

git add .

   OR 

git add file1.txt file2.txt

git commit -m "You commit description"

git push origin master
Channaveer Hakari
  • 2,769
  • 3
  • 34
  • 45
1

To fetch your code from your remote repository from GitHub you use the command git pull. This fetches the latest changes and merges them with your local code so you have the most recent code. You can find a Git cheat sheet with most of the commands you will need here

Pritam Sangani
  • 271
  • 1
  • 15