How to remove notes refs in Gerrit - gerrit

We are using Gerrit 2.x. I have pushed a notes ref to Gerrit, e.g. refs/notes/foobar. Now I would like to remove that ref from the project in Gerrit. I am project owner but not Gerrit admin. How can this be accomplished?
The UI lacks generic refs access, and no notes either
The REST API only supports branches and tags endpoints (no notes nor `refs)
Using the branches and tags REST API endbpoints, e.g. .../branches/refs%2Fnotes%2F/foobar
I am unable to find anything related to this in documentation

Removing refs for notes can be done by removing the reference and pushing the removed reference to Gerrit:
git fetch -f origin refs/notes/foobar:refs/notes/foobar
git notes --ref foobar remove HEAD
git push ssh://gerrit.local:29418/my-project/baz.git refs/notes/foobar

Related

How see which version of Rails a particular commit was applied to?

Frequently when researching a problem, I come across a commit in Rails that addresses the issue.
But how does someone see which version of Rails first incorporated that fix?
For example, an issue with a missing /tmp/pid folder was fixed in this Rails commit:
https://github.com/rails/rails/commit/70e6ff2ed8596eb9bd6dcce87cb3f14015638d70
But how can I see which version of Rails included that fix?
To see what specific version includes a certain commit you need to look at the tags in the repository:
max#pop-os ~/p/rails> git tag --contains 70e6ff2ed8596eb9bd6dcce87cb3f14015638d70
v6.0.1
v6.0.1.rc1
v6.0.2
v6.0.2.1
v6.0.2.2
v6.0.2.rc1
v6.0.2.rc2
v6.0.3
v6.0.3.1
v6.0.3.2
v6.0.3.3
v6.0.3.4
v6.0.3.rc1
git branch --contains <commit id> can also be used to find new commits that are not yet tagged. Such as commits on master that haven't yet been "released".
To do this you first need to clone the repository off Github and fetch all the branches (or a least the stable branches).

Work with libgit2sharp to retrieve only the latest revision of a specific branch

Consider the following scenario:
Some content (e.g. a web-site) is under git repository having several branches like master (for dev), qa and prod.
A .net application (e.g. some cloud service) needs to have always the latest version of one specific branch (e.g. prod). There is no need to fetch full repository, only HEAD of this branch (git clone -b <branch> --depth=1 <remote_repo_url> --single-branch) and perform consequent updates.
How would you implement such scenario with libgit2sharp library?
Cloning only a truncated portion of the history from a repository (ie. shallow cloning) is not supported by LibGit2Sharp yet.
You can subscribe to issue #229 to be notified of future progress.

Rails: Rubymine: GitHub

I can't seem to figure out how to commit my files to GitHub.
I am using RubyMine 4.5 on the MAC
I have git set up locally
I have a private account on GitHub
From the RubyMine Preferences, I have my GitHub credentials properly set up (and acknowledged as such by RubyMine), but it did not give me an option to select a repository on GitHub.
How do I commit file to the GitHub repository? There are too many CVS and Git menu items in RubyMine.
PS: I've read the online help sections (the only thing available to me), and I followed the instructions in the GitHub integration, but the directory I'm trying to commit is failing to push to GitHub, with RubyMine telling me that there was nothing to commit. This is the first time I use RubyMine for GitHub. Nothing about this on StackOverflow.
Okay, I think I've recreated your situation locally and it appears that RubyMine has terrible support for managing remotes. If you create a Git repository locally, then (separately) create a repository on GitHub, there's no obvious way to marry the two from within RubyMine.
Basically, you need to set up GitHub as a remote for your local repository from the shell, and once that's done then RubyMine will be able to push as normal.
Please note that the below instructions assume you want to overwrite your GitHub repository with the full history from your local repository -- If your GitHub repository has data that you do not want to lose, do not execute these commands! See Below.
Open up Terminal:
cd /path/to/my/project/root
git remote add origin https://github.com/yourusername/yourrepo.git
git push -u origin +master
Now, RubyMine should be able to push to your GitHub repository via VCS > Git > Push
If your GitHub repository has already been committed to and you don't want to lose those changes, you'll need to either create a new GitHub repo or clone your GitHub repo into another folder and merge your local repository into the clone.
This can be avoided entirely if you're trying to push your existing local repository to a new GitHub repo: Simply use the VCS > Import into Version Control > Share project on GitHub option and use the dialog to create a new GitHub repository.

How do I tag my git repository using the GitHub Mac application?

I pretty new to GitHub and personally did not have time to learn too much command line. I prefer using the GitHub Mac app for my personal projects and I was curios if I can add tags with it.
Basically I just want to tag my projects v0.1 and so on. I'm not even sure this is the best way to do it.
From VonC's answer to the same question asked on SuperUser:
Both in their announcement and in the help section, this (tag) doesn't seem to be available (at the time of the writing of this answer).
That means GitHub for Mac doesn't manage yet the tags namespace (refs/tags), and that you need to tag manually, and then git push --tags to GitHub also manually.
Though that was a year ago, there's still nothing to indicate that tags are supported. There's still no mention in the help section, subsequent blog posts about it don't mention tags, nor do the release notes (though they only cover relatively recent versions).
Unfortunately, Github Client for Mac still doesn't handle tags.
Neither to create them or nor to retrieve them
The Github website on its side propose not only to retrieve tagged commits, but also show them as releases and propose automaticly generated zip and tar.gz bundles of the related source code.
see:
https://help.github.com/articles/working-with-tags
https://help.github.com/articles/about-releases
https://github.com/blog/1547-release-your-software
https://help.github.com/articles/creating-releases
The good news is that tag are pulled to you local repository when doing a "sync" or a "pull" from Github Client for Mac
As #blahdiblah said, you'll have to go through command lines to manage tags locally
The "official" documentation regarding tag manipulations in command line is there:
http://git-scm.com/book/en/Git-Basics-Tagging
Usage is very simple:
git tag list tags
git tag -a v1.4 -m 'my version 1.4' create a tag with a description
git show v1.4 show informations about a tag
git push origin --tags push last commits and the tags
To create a tag manually via the command line:
open Terminal and navigate to your repository (either via cd or just drag in the folder from Finder)
use the following commands:
git remote (displays the name of your remote, for example YourRemote)
git tag -a v1.2 -m 'tagging Version 1.2' (creates tag v1.2 from current branch)
git push YourRemote v1.2 (pushes the tag you've created to YourRemote)
http://pinkstone.co.uk/how-to-tag-a-release-in-git/

Setting up Github on a new computer

I am an almost perfect beginner at Github so please humor me with this elementary question.
I have a laptop PC that I've been using to interact with a repo on Github. I just bought a Mac and I would like to do my programming on both machines.
I have installed Git on the new machine and I have set up my username, e-mail, and Github token on the Terminal.
What are the basic commands I need to do this:
Download the repo from Github the first time? I've created a new folder on my Mac but going there and typing git pull git#github.com/sscirrus/repo.git produces fatal: not a repository (or any of the parent directories): .git.
Upload those changes again such that the main repo is updating cleanly with each new push. I assume that once I have the code in my new folder, it would be a matter of git add . and git push with password entry?
I am reading through tutorials on Git but just want to make sure I'm doing something sensible for my situation before my newbieness screws up a lot of prior work. Thank you!
Go through this book, http://progit.org/book/ and http://gitcasts.com/ for video tutorial.
And I recommend you follow these steps
Clone the repository (git clone repoAddress)
create a new branch (git branch branchName)
checkout that branch (git checkout branchName)
make changes and commit in that branch (git add files)
checkout master (git checkout master)
perform a pull (it updates the local repository with the remote one) git pull
If there is change, checkout the branch and rebase it with local master
If there is conflict resolve it and add that file and make a commit again
checkout master again and merge the branch (git merge branch)
push the commits to the remote repository.(git push)
If you want a GUI tool, then there is GitX which is made for Mac OS X. http://gitx.frim.nl/
Download the git repo for first time - do a clone of the repo first. this will bring your code from github to your machine for the first time.
git clone your_git_repo_url
from second time, you can
git pull your_git_repo_url
Upload the changes after commits
git push your_git_repo_url
Please read scott chacons git books. these will get you the basics of git. and learning this will help in the long run.
You need to use git clone, not git pull.
You'll want to git commit after add and before push. add just adds something to the index (Worst name ever. The "index" is essentially a pending commit.) and commit actually commits it to your repository. push then pushes committed stuff from your local repository to a remote repository.
Whilst there's a lot to be said for using git from the command line (to help understanding) you might like to try the github clients (for mac & windows - download them from the github homepage - at the bottom in the section marked 'clients') which I'm guessing might not have been available when you posted your question.
The Windows one lets you specify a default storage directory (where it clones the repos into) - the Mac one prompts you with each clone as to where you want to stick it.
Both very easy to use to do what you want (clone, pull, push etc and also good for seeing what branches you have and changing between them)

Resources