Mark As Completed Discussion

Synchronize local and remote repositories

The changes you make to the repository, to the files, or the branches, will stay on your local machine unless you synchronize with the remote one. Same goes the other way - if you do not synchronize, you will not have the latest changes someone else did on the repo.

Synchronize repositories

The following commands will help you stay up to date, and manage your repositories:

Fetch This command takes the latest commits from the remote repository, but it does not add them to a local branch on your workspace.

SNIPPET
1$ git fetch

Pull Pull does take those changes, and it does it by performing a fetch, followed by a merge command, which puts the changes in a local branch.

SNIPPET
1$ git pull

Push By using push, you transfer the local changes, to the remote repository. Before using push, you have to use the commit and add command in order to prepare the changes for pushing.

SNIPPET
1$ git add .
2$ git commit -m "commit message"
3$ git push

Synchronize repositories