Saturday 3 October 2020

Working with Forks

Sinkronisasi Upstream Git Tag ke Local Fork

cd /path/to/fork/clone

git remote add upstream url/original/repo

git fetch --tags upstream

#Push the tag from my local to my master branch

git push -f --tags origin master

Referensi

  1. Configuring a remote for a fork, https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/configuring-a-remote-for-a-fork
  2. Syncing a fork,  https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/syncing-a-fork
  3. Upstream git tag is not showing in forked repository, https://stackoverflow.com/questions/51006930/upstream-git-tag-is-not-showing-in-forked-repository

Wednesday 29 July 2020

How to Move a Private Repository from Bitbucket to Github


$ git clone https://USER@bitbucket.org/USER/PROJECT.git
$ cd PROJECT
$ git remote add upstream https://github.com:USER/PROJECT.git
$ git push upstream master
$ git push --tags upstream


Tuesday 28 April 2020

How to discard local changes and pull latest from Git repository

Sometimes we want to pull latest code from Git repository and ignore all changes in locales.

Run the below commands (or you can see directly on web interface git repo you used)

git log

From this you will get your last push commit hash key

Or you can

git reset --hard <your commit hash key>


Saturday 19 November 2016

Subrepository

Status  : Draft

Subrepository Git

Untuk menambahkan subrepository git, kita tinggal membuat file .hgsub, contoh entri .hgsub :

application/webroot/js/MathJax = [git]https://github.com/mathjax/MathJax.git
mias/MathMLCan = [git]https://github.com/OpenThink-Labs/MathMLCan.git
mias/MathMLUnificator = [git]https://github.com/OpenThink-Labs/MathMLUnificator.git
mias/MIaSMath = [git]https://github.com/OpenThink-Labs/MIaSMath.git
mias/MIaS = [git]https://github.com/OpenThink-Labs/MIaS.git
mias/WebMIaS = [git]https://github.com/OpenThink-Labs/WebMIaS.git
Untuk lebih detail, bisa membaca [1]

Ketika menggunakan subrepository berupa Git, ketika push, maka subrepository Git ini akan ikut dipush. Terkadang kita tidak ingin hal ini terjadi. Agar ketika proses push, subrepository tidak ikut dipush, kita bisa menggunakan workaround [2] :

hg push --config extensions.gitsubreadonly=/path/to/contrib/gitsubreadonly.py
Commit dan Push Subrepository

Untuk commit subrepos dapat menggunakan perintah :

hg commit --subrepos -m "pesan commit" 


Lalu, untuk push :

hg push
Untuk meng-enable git subrepository, tambah konfigurasi berikut di .hgrc :

[subrepos]
git:allowed = true

Referensi

  1. Subrepository, https://www.mercurial-scm.org/wiki/Subrepository#Git_subrepositories
  2. gitsubreadonly: add naive hack to avoid issue #194, https://bitbucket.org/durin42/hg-git/pull-requests/52/gitsubreadonly-add-naive-hack-to-avoid/diff
  3. Mercurial Kick Start Exercises, Subrepositories, http://mercurial.aragost.com/kick-start/en/subrepositories/

Monday 25 July 2016

Mercurial/Hg - abort: outstanding uncommitted merges

Jika menemui error tersebut, solusinya :

mercurial@openthinklabs$ hg update --clean -r tip

Referensi

  1.  Mercurial / hg - abort: outstanding uncommitted merges, http://stackoverflow.com/questions/12690557/mercurial-hg-abort-outstanding-uncommitted-merges