Git

Create a zip archive of repository Reference git archive --prefix=riboplot/ -o /tmp/riboplot_0.3.1.zip HEAD Undo changes Reference When changes have already been pushed to a remote, use git revert: git revert commit_id Otherwise, to undo the last commit: git reset --soft HEAD~1 To undo and …

Create a zip archive of repository

Reference

git archive --prefix=riboplot/ -o /tmp/riboplot_0.3.1.zip HEAD

Undo changes

Reference

When changes have already been pushed to a remote, use git revert:

git revert commit_id

Otherwise, to undo the last commit:

git reset --soft HEAD~1

To undo and throw away uncommitted changes including ones staged to index:

git reset --hard HEAD~1

Optionally, a commit id can be provided instead of HEAD~1.

Tagging commits

git tag -a 18.04 -m "Release - 18.04" 3e9e591da3

Push tags to remote:

git push --tags

Keep changes associated with a detached HEAD

To display the most recent commit on the detached HEAD, run:

git log -n 1

Copy and save the commit hash.

Checkout master branch:

git checkout master

To save changes in a new branch called tmp:

git branch tmp <commit-hash>

If you would like to incorporate changes you made into master, run git merge tmp from the master branch. You should be on the master branch after running git checkout master.

Large File Support (LFS)

sudo apt install git-lfs

Hosting LFS objects externally

Disable repository mirroring on GitLab

It is possible to host LFS objects externally by setting a custom LFS url with

git config -f .lfsconfig lfs.url <https://gitlab.com/vimalkvn/riboplot.git/info/lfs>`

This message might appear:

Locking support detected on remote "origin". Consider enabling it with
git config <lfs.https://gitlab.com/vimalkvn/riboplot.git/info/lfs.locksverify> true

This happens because GitLab verifies the existence of objects referenced by LFS pointers, push will fail when LFS is enabled for the project. LFS can be disabled from project settings.

Comments