<commit_before>---
layout: page
title: Git
---

[Back to Cheat Sheets](/resources/cheat-sheets/)

[Other Git Tips](http://mislav.uniqpath.com/2010/07/git-tips/)

## Table of Contents

- [Man Pages](#man-pages)
- [Git Branching](#git-branching)
- [Git Checkout](#git-checkout)
- [Git Commit](#git-commit)
- [Git Diff](#git-diff)
- [Git Log](#git-log)
- [Git Push](#git-push)
- [Git Rebase](#git-rebase)
- [Git Remote](#git-remote)
- [Git Remove](#git-remove)
- [Git Reset](#git-reset)
- [Git Stash](#git-stash)
- [Git Update-Index](#git-update-index)
- [Tagging](#tagging)
- [Patching](#patching)
- [Misc](#misc)

## Man Pages

```shell
# Manuals
# You can view the manual pages on any of the commands below by using
# 'man git-' followed by the verbs supported by Git such as 'log' or 'commit'
man git-log
man git-commit
```

## Git Branching

```shell
# view local branches with verbose output (includes remote tracking)
git branch -vv

# view remote branches
git branch -r

# view local and remote branches
git branch -a

# delete local branch
git branch -d my_branch_name

# rename branch
git branch -m old_name new_name

# delete a tracking branch
git branch -r -d otherguys/master

# rename local and remote branch
git branch -m old_name new_name
git push origin :old_name # delete old remote branch
git push origin new_name # create new branch on remote
git branch --set-upstream-to=origin/new_name

# set upstream tracking for branch
git branch -u origin/feature_branch
git branch -set-upstream-to=origin/feature_branch
```
<commit_msg>Adds Git-Push command to set upstream while pushing to specified remote with branch name<commit_after>---
layout: page
title: Git
---

[Back to Cheat Sheets](/resources/cheat-sheets/)

[Other Git Tips](http://mislav.uniqpath.com/2010/07/git-tips/)

## Table of Contents

- [Man Pages](#man-pages)
- [Git Branching](#git-branching)
- [Git Checkout](#git-checkout)
- [Git Commit](#git-commit)
- [Git Diff](#git-diff)
- [Git Log](#git-log)
- [Git Push](#git-push)
- [Git Rebase](#git-rebase)
- [Git Remote](#git-remote)
- [Git Remove](#git-remove)
- [Git Reset](#git-reset)
- [Git Stash](#git-stash)
- [Git Update-Index](#git-update-index)
- [Tagging](#tagging)
- [Patching](#patching)
- [Misc](#misc)

## Man Pages

```shell
# Manuals
# You can view the manual pages on any of the commands below by using
# 'man git-' followed by the verbs supported by Git such as 'log' or 'commit'
man git-log
man git-commit
```

## Git Branching

```shell
# view local branches with verbose output (includes remote tracking)
git branch -vv

# view remote branches
git branch -r

# view local and remote branches
git branch -a

# delete local branch
git branch -d my_branch_name

# rename branch
git branch -m old_name new_name

# delete a tracking branch
git branch -r -d otherguys/master

# rename local and remote branch
git branch -m old_name new_name
git push origin :old_name # delete old remote branch
git push origin new_name # create new branch on remote
git branch --set-upstream-to=origin/new_name

# push branch to remote and set as upstream
git push --set-upstream remote branch-name

# set upstream tracking for branch
git branch -u origin/feature_branch
git branch -set-upstream-to=origin/feature_branch
```

{'fraction_non_alphanumeric': 0.13050169282856264, 'fraction_numerical': 0.003693444136657433, 'mean_word_length': 4.17515923566879, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '98021', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1045, 'n_words': 374}