Hard reset of a single file

You can use the following command: … which will update both the working copy of my-file.txt and its state in the index with that from HEAD. — basically means: treat every argument after this point as a file name. More details in this answer. Thanks to VonC for pointing this out.

Hard reset of a single file

You can use the following command: … which will update both the working copy of my-file.txt and its state in the index with that from HEAD. — basically means: treat every argument after this point as a file name. More details in this answer. Thanks to VonC for pointing this out.

error: cannot lock ref.. ‘refs/tags’ exists; cannot create ‘refs/tags/

Your Git is complaining that a reference (rather than a directory) named refs/tags exists. It’s not clear what would create that, but see if git rev-parse refs/tags produces a hash ID. If so, that reference needs to go away: after which git fetch should work. If git rev-parse refs/tags fails (which it should—refs/tags itself should not be a valid name) then this is not the problem and it’s …

Read more

git status (nothing to commit, working directory clean), however with changes commited

Your local branch doesn’t know about the remote branch. If you don’t tell git that your local branch (master) is supposed to compare itself to the remote counterpart (origin/master in this case); then git status won’t tell you the difference between your branch and the remote one. So you should use: or with the short option: This options –set-upstream-to (or -u in …

Read more

What do raw.githubusercontent.com URLs represent?

The raw.githubusercontent.com domain is used to serve unprocessed versions of files stored in GitHub repositories. If you browse to a file on GitHub and then click the Raw link, that’s where you’ll go. The URL in your question references the install file in the master branch of the Homebrew/install repository. The rest of that command just retrieves the file and runs ruby on its contents.

Throw away local commits in Git

If your excess commits are only visible to you, you can just do git reset –hard origin/<branch_name> to move back to where the origin is. This will reset the state of the repository to the previous commit, and it will discard all local changes. Doing a git revert makes new commits to remove old commits in a way that keeps everyone’s history sane.