abbas.aniefa
abbas.aniefa

Reputation: 2905

update forked project on GitLab

I have forked project A in GitLab and create B and made some modification. After a month now i would like to update B project by pulling changes done in A.

How can i do this? I have option to create Merge request but i could't able pull from A.

I know this could be very simple because if anyone like to contribute has eventually take pull before submitting merge request.

Please help. I found only this https://about.gitlab.com/2016/12/01/how-to-keep-your-fork-up-to-date-with-its-origin/

Basically i want to "Pull new updates from original GitLab repository into forked GitLab repository"

Upvotes: 4

Views: 4271

Answers (2)

Stuart Cardall
Stuart Cardall

Reputation: 2447

If you don't have Gitlab Premium (so mirroring is not possible) - you can use a shell function in your ~/.bashrc or ~/.profile (busybox shell)

gitpull () {
        git checkout master
        git fetch upstream
        git pull upstream master
        if [ $? = 0 ]; then
                printf "\ngit fetched into master ok: pushing => fork (origin)\n\n"
                git push origin +master
        fi
}

Upvotes: 0

abbas.aniefa
abbas.aniefa

Reputation: 2905

I found an option to update my forked project via Android Studio. It may help some android developers.

I have added new Remote URL via Git -> Add Remote and named as upstream. Now i have done a fetch (Git -> Fetch) and found both Project A and Project B branches.

Now i can easily update my Project B using Merge request and pushed to origin.

Upvotes: 2

Related Questions