# git commands

NOTE: if the folder is a git-repo, there should be a `.git` folder present.

## Git Commands

```bash
# preset config
git config --global user.email "kashz@kashz.com"
git config --global user.name "kashz"

# check history of commit
git log

# # diff commit check
git diff COMMIT^!
git diff COMMIT1 COMMIT2
git diff-tree -p COMMIT

# adding file to repo
git add FILE

# add new commit
git commit -m MESSAGE

# push update to repo
git push -u origin
```

## git commands using SSH

```bash
GIT_SSH_COMMAND='ssh -i id_rsa -o IdentitiesOnly=yes [-p PORT]' GIT COMMAND HERE

# git clone over ssh
GIT_SSH_COMMAND='ssh -i id_rsa -o IdentitiesOnly=yes [-p PORT]' git clone user@IP:/PATH-TO-GIT
```

## git-shell info

* <https://linux.die.net/man/1/git-shell>
* Restricted to only perform git-related commands
* Only four commands are permitted
  * git-receive-pack
  * git-upload-pack
  * git-upload-archive with a single required argument
  * cvs server (to invoke git-cvsserver).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kashz.gitbook.io/kashz-jewels/tricks/git-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
