• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/21

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

21 Cards in this Set

  • Front
  • Back

Remove files from the working tree and from the index

git-rm




git rm will not remove a file from just your working directory. (There is no option to remove a file only from the working tree and yet keep it in the index; use /bin/rm if you want to do that.) The files being removed have to be identical to the tip of the branch, and no updates to their contents can be staged in the index, though that default behavior can be overridden with the -f option.

Store dirty changes



git stash


git stash apply




git stash apply stash@{2}


If you don’t specify a stash, Git assumes the most recent stash and tries to apply it




Having a clean working directory and applying it on the same branch aren’t necessary to successfully apply a stash. You can save a stash on one branch, switch to another branch later, and try to reapply the changes. You can also have modified and uncommitted files in your working directory when you apply a stash — Git gives you merge conflicts if anything no longer applies cleanly.

To see which stashes you’ve stored

git stash list




stash@{0}: WIP on master: 049d078 added the index file


stash@{1}: WIP on master: c264051 Revert "added file_size"


stash@{2}: WIP on master: 21d80a5 added number to log

Remove from stash

git stash drop stash@{0}




You can also run git stash pop to apply the stash and then immediately drop it from your stack

Un-applying a Stash

git stash show -p stash@{0} | git apply -R

Reapply commits on top of another base tip

git-rebase

Switch branches or restore working tree files

git checkout

Download objects and refs from another repository

git fetch



git fetch can fetch from either a single named repository or URL, or from several repositories at once if is given and there is a remotes. entry in the configuration file. (See git-config[1]).




When no remote is specified, by default the origin remote will be used, unless there’s an upstream branch configured for the current branch.

See log history

git log

Initialize repository

git init

git fetch vs git pull

git pull does a git fetch followed by a git merge.




You can do a git fetch at any time to update your remote-tracking branches under refs/remotes//.




This operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy. I have even heard of people running git fetch periodically in a cron job in the background (although I wouldn't recommend doing this).




A git pull is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.

Send changes

git push origin master


where master is the branch you want to send your changes to

Connect an existing local repo to a remote repo

git remote add origin <server>


origin is the name you give to the remote (aka GitHub)




git push origin master is the same as git push origin master_on_my_machine:master_on_github


Si no has clonado un repositorio ya existente y quieres conectar tu repositorio local a un repositorio remoto, usa git remote add origin Ahora podrás subir tus cambios al repositorio remoto seleccionado.


Create new branch and change to it

git checkout -b [name_of_your_new_branch]




Shorthand for


$ git branch iss53


$ git checkout iss53




Push the branch on github :


$ git push origin [name_of_your_new_branch]




When you want to commit something in your branch, be sure to be in your branch.

Delete branch

Delete a branch on your local filesystem :


$ git branch -d [name_of_your_new_branch]




To force the deletion of local branch on your filesystem :


$ git branch -D [name_of_your_new_branch]




Delete the branch on github :


$ git push origin :[name_of_your_new_branch]

check which files of your local repo have been modified

git status

See all branches

git branch

reemplazar cambios locales

git checkout -- <filename>


git checkout master




Este comando reemplaza los cambios en tu directorio de trabajo con el último contenido de HEAD. Los cambios que ya han sido agregados al Index, así como también los nuevos archivos, se mantendrán sin cambio.

traer la última versión del servidor y apuntar a tu copia local principal de esta forma

git fetch origin


git reset --hard origin/master

Create tag 1.0.0

git tag 1.0.0 1b2e1d63ff




1b2e1d63ff se refiere a los 10 caracteres del commit id al cual quieres referirte con tu etiqueta.

overwriting committed snapshots: fix up the most recent commit.

git commit --amend