Saturday, April 25, 2020

some git commands and github

For the error
Cannot pull with rebase: You have unstaged changes.
from https://stackoverflow.com/questions/23517464/error-cannot-pull-with-rebase-you-have-unstaged-changes
(when trying to do
git pull
before
git push
)

If the pull complains that you have changes,
git stash
git pull
git stash pop

git add relative/path/to/filename/which/has/changed
OR
git add directory/name/which/has/changed
git commit
git push

OR
git add -u # for adding changes to all previously staged files
git commit
git push


Atlassian's git cheat sheet is also useful, especially the first page.
git init
OR
git clone
to initialize local repo.

To copy a folder from one repo to another on github, a somewhat elaborate process, if you want to preserve histories.

And if you just want to download a single directory from a repo on github, this post has a nice solution using github's svn features - navigate to the folder you want on github, copy the url, change tree/master to trunk in the url, and pass it to svn.
For example, to download the directory https://github.com/hn-88/OCVWarp/tree/master/octave
the command would be
svn checkout https://github.com/hn-88/OCVWarp/trunk/octave

Edit: updated with pushing git tags.
For deleting a remote tag, if the name of the tag you wish to delete was v1
git push --delete origin v1

More basics of git and tags from here,
git clone
cd to the repo
To view existing tags,
git tag
To create a new tag called v2.11
git tag v2.11
To push the tag to remote,
git push origin --tags

But AppImages created with Travis-CI even with this git push --tags, still show up with the commit hash instead of the tag in the filename. Will need to look into it.

No comments:

Post a Comment