Fichas
Git
Fichas del conjunto (28)
- 1The .gitContains files, history, config managed by Git
- 2The 3 stages1 - Working directory
2 - Staging area
3 - Commit area
* Github - 3starting a project with gitgit init project_name
- 4setting up gitgit config --global user.name
git config --global user.email - 5checking the current branchgit status
- 6list current configurationgit config --global --list
- 7adding all files to staging areagit add .
- 8forking repositoriesfrom github -> fork , make a copy of another github repo
git clone github.com/link to clone localy - 9pull and pushit's good practice to pull before pushing to be up to date with the latest changes
- 10add and commit with one comandgit commit -am "mesage"
*adds only tracked files - 11checking tracked filesgit ls-files
- 12unstaginggit reset HEAD file_name
- 13reverting changesgit checkout -- file_name
- 14git mv file_1 file_2renames file 1 to file 2 and stages it
- 15git add -Aadds all files to staging area
AND
updates all current, moved and renamed files - 16git rmremoves tracked files, git reset does not retrive the file but git checkout does
- 17git logshow commit history
- 18git showshows commit id's info
- 19git aliasesgit config --global alias.name "command"
or
vim ~/.gitconfig - 20.gitignorefiles and dirs git will ignore
- 21the git diff and git difftool commandshows the difference between the staging area and the working directory ( in vim side by side)
the HEAD option compares working dir with repository
the --staged HEAD options compare the staging area with the repository
id_1 id_2 will show changes from id_1 to id_2
HEAD HEAD^ wil show changes from the last commit
master origin/master compares local to pushed repository - 22vimdiffone of the difftools possible settings
add it to .gitconfig like this
[diff]
tool = vimdiff - 23git brachesgit branch -a ----- lists branches
git banch branch_name ------ creates new branch
git checkout branch_name ---- switches to another branch
git branch -m name newname --- rename
git branch -d name -----delete
git diff/difftool b1 b2 to compare branches - 24git mergegit merge branch-name to merge current branch with branch-name
--no--ff no fastforward merge - 25git fetchupdates reference , updates what happened to the remote
- 26git rebaseFind out what this command does
- 27git stashsave changes (* to tracked files) made to be reapplied later
the "apply" option applies the stash to current working directory
the "list" commands provides info about the stash
the "drop" option deletes the stash
"-u" add untracked files
git stash pop = git stash apply + git stash drop - 28more on git stashgit stash pop = git stash apply + git stash drop
git stash save "name" = saves stashed with name
git stash show stash@{n} = show the nth stash
git stash apply stash@{n}= apply the nth stash
git stash clear = delete all the stashed
git stash branch name = create branch switch to it and drop the stash
Información
- Descripción
- Computer Science Fichas sobre Git, creado por Mircea Chira el 21/11/2016.
- Creado por
- Mircea Chira
- Visitas
- 1
- Valoración