You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
git add `filename.ext` // Add a single file
git add -A // Add all 'working directory' and 'unstaged' files
3) Commit the files
git commit -m `commit_message``
4) Reset all changes in the 'working directory' and 'unstaged'
git stash -u
5) Show commits:
git log // Show all commits (default visualization)
git log -p // Show all commits with all its data
git log --pretty=oneline // Single lines
git log --stat // Show commit statistics
git log --since=`x`.days || git log --since=`x`.weeks // Show a time based list of commits
6) Move files from 'staging area' back to the 'working directory'
git reset HEAD `filename.ext`
7) Coming back versions
git checkout `commit_hash` // Creates a new branch at the commit point
git checkout `commit_hash` --soft // Returns the project to the given commit, keeping the 'untracked' and 'working directory' files untouched
git checkout `commit_hash` --hard // Returns the project to the given commit, but in the commit state. (with files already commited)
8) Working with branchs
git branch // Show all branchs
git branch `branch_name` // Creates a new branch from the current branch
git checkout -b `branch_name` // Creates a new branch and checkout to it
git checkout `branch_name` // Checkout to the branch
git merge `branch_name` // Merges the `branch_name` commits to the current branch
git rebase `branch_name` // Rebase (merge and organize) commits from the `branch_name` to the current branch (Prefer to use only locally)
git branch -d `branch_name` // Deletes a branch
9) Using GIT blame
git blame `file` // Show the author of all the file lines
git blame `file` -L `from_line`,`up_to_line` // Show the specified lines author