spabloramirez
11/3/2014 - 4:04 PM

git

Show untracked files

git status 
          -u (list of files)
          --ignored     

Manual

git <comando> --help

List of commands

man git 
```

### CREATE REPOSITORIES

**Creates a new local repository**
```
git init [project-name]
```

# Alias

**Associate alias to a remote repository**
```
git remote add <alias> <url>
```


**list remote repositories**

*git remote -v* 

git clone <url> [folder]//Downloads a project and its entire version history

MAKE CHENGES
git status //list files to be committed
git add <file|.|.txt|--all|-u> 
  //all:añade tambien eliminados 
  //u: add only modified
git reset [file] //unstages the file, but preserve its changes
git commit [-a] -m '<message>' 
git commit --ammend //include changes in the last commit

git diff //shows files differences not yet staged (diferencia aun no añadidas)
git diff --staged //show differences between staging area and the repository (diferencia aun no comiteadas)
git log [--stat]
git diff --name-only SHA1 SHA2 //only files modified

REDO COMMITS
git reset [commit]//Undoes all commits afer [commit], preserving changes locally
git reset --hard [commit]//Discards all history and changes back to the specified commit
git clean -f -d //remove untracked

SYNCHRONIZE CHANGES
git fetch [bookmark]//Downloads all history from the repository bookmark
git merge [bookmark]/[branch]//Combines bookmark’s branch into current local branch
git push [alias] [branch]//Uploads all local branch commits to GitHub
git pull//Downloads bookmark history and incorporates changes

GROUP CHANGES
git branch [-v] //Lists all local branches in the current repository
git branch [branch-name] //Creates a new branch
git checkout [branch-name] //Switches to the specified branch and updates the working directory
git merge [branch] //Combines the specified branch’s history into the current branch
git branch -d [branch-name] //Deletes the specified branch

//EXAMPLE CRETE REOPOSITORY FROM EXISTING PROYECT
touch README.md //create description file
git init

git add --all
git status

git commit -m "first commit"
git status

git remote add origin https://github.com/spabloramirez/GitTest.git
git remote -v //view remote repository alias->url

git push -u origin master


//working area (local)-add
//staying area (local)-commit
//repository (local)-push
//repository (remote)

DOWNLOAD REMOTE BRANCH
git checkout -b feature/menu-movil origin/feature/menu-movil

//reseting remote to a certain commit
 git reset --hard <commit-hash> //local
 git push -f origin master //update remote
//elimina de local y del remoto al hacer push
git rm mylogfile.log
//elimina del remoto pero no del local
git rm --cached mylogfile.log
git rm --cached -r mydirectory

git update-index --assume-unchanged path/to/file

git reflog
git branch <name> <reflog-id>

git fetch --all
git reset --hard origin/master
git flow   <feature|release|hotfix>    <start|finish>    Name
git config --global user.email "[email address]"
git config --global user.name "[name]"

git config core.autocrlf false //disable line endig conversions
git config --global color.ui auto //enables colorization output
git config --list //check configuration