git error: failed to push some refs to remote

(Note: starting Oct. 2020, any new repository is created with the default branch main, not master. And you can rename existing repository default branch from master to main.The rest of this 2014 answer has been updated to use “main“) (The following assumes github.com itself is not down, as eri0o points out in the comments: see www.githubstatus.com to be sure) If the GitHub repo has seen new commits pushed to it, while … Read more

Git: How do I force “git pull” to overwrite local files?

⚠ Important: If you have any local changes, they will be lost. With or without –hard option, any local commits that haven’t been pushed will be lost.[*] If you have any files that are not tracked by Git (e.g. uploaded user content), these files will not be affected. First, run a fetch to update all origin/<branch> refs to latest: Backup your … Read more

How to delete a remote tag?

You can push an ’empty’ reference to the remote tag name: Or, more expressively, use the –delete option (or -d if your git version is older than 1.8.0): Note that git has tag namespace and branch namespace so you may use the same name for a branch and for a tag. If you want to … Read more

Git fetch remote branch

Update: Using Git Switch All of the information written below was accurate, but a new command, git switch has been added that simplifies the effort. If daves_branch exists on the remote repository, but not on your local branch, you can simply type: Since you do not have the branch locally, this will automatically make switch … Read more

What is the difference between git push origin and git push origin master

The default action of git push and git push origin has changed since git version 1.7.11: Before 1.7.11, git push by default pushes all branches that also exist remotely with the same name. Since 1.7.11, git push by default pushes the current branch to a remote branch with the same name. Before and after version 1.7.11, the default behavior can be configured with the push.default configuration option. This configuration option has … Read more

What does ‘git blame’ do?

From git-blame: Annotates each line in the given file with information from the revision which last modified the line. Optionally, start annotating from the given revision. When specified one or more times, -L restricts annotation to the requested lines. Example: Please note that git blame does not show the per-line modifications history in the chronological sense. It only … Read more