Git


Ignore files only locally

List these files in

  1. .git/info/exclude

How to revert Master branch to upstream

  1. git remote update
  2. # the double hyphen ensures that upstream/master is considered as a revision and not confused as a path
  3. git reset --hard upstream/master --

Then push this new branch-head to your origin repository, ignoring the fact that it won't be a fast-forward:

  1. git push origin +master

May also need to run git remote add upstream <upstream_repo_url> if you forked the branch using GitHub.

How to delete a Git branch both locally and remotely

Delete remote branch
  1. git push origin --delete <branch_name>
Delete local branch
  1. git branch -d branch_name

How to apply unmerged upstream pull requests from other forks into my fork

  1. git remote add otherfork git://github.com/request-author/project.git
  2. git fetch otherfork
  3. git cherry-pick <first-SHA1> <second-SHA1> <etc.>

Get SHA1 from git log or from github.com/bitbucket.org etc.

How to clone a single branch in git?

  1. git clone <url> --branch <branch> --single-branch [<folder>]



 RSS of this page

Written by:   Version:   Edited By:   Modified