Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to "resync" commits in GitLab after fetching from remote repository?

Tags:

gitlab

I've created GitLab project by cloning remote repository. During a few days my colleagues pushed their commits to the original repository (not GitLab). Now I did 'git fetch --all' from GitLab repository but commits do not show in GitLab web UI. What should I do to resync GitLab project with its repository? Is there rake task for that? I can't simply recreate the project as we already imported issues from an external source, created labels, milestones, etc.

like image 960
Fedor Avatar asked Sep 13 '14 14:09

Fedor


People also ask

How do I pull a commit from a remote?

The short answer is: you cannot pull a specific commit from a remote. However, you may fetch new data from the remote and then use git-checkout COMMIT_ID to view the code at the COMMIT_ID .

How do you commit changes to remote repo?

To push the commit from the local repo to your remote repositories, run git push -u remote-name branch-name where remote-name is the nickname the local repo uses for the remote repositories and branch-name is the name of the branch to push to the repository. You only have to use the -u option the first time you push.


1 Answers

There is no GitLab feature to fetch the upstream updates. What you did was import an already existing repository, and that is a one time feature.

But you can fetch the upstream updates into your local repository, then push them to GitLab. You'll need to add the orginial/upstream repo as a remote to your local repository by running git remote add upstream {path to original repo}, then fetch the upstream repos by running git fetch upstream, then merge git merge upstream/master, then git push master origin.

GitHub has a decent help section on adding the upstream remote, and doing the merge.

like image 197
Steven V Avatar answered Jan 04 '23 05:01

Steven V