git status -uno
git checkout --track origin/<branc-name>
Delete the branch locally:
git branch -d <branch-name>
Create the branch locally:
git checkout -b <branch-name>
Create the branch remotely:
git push -u origin <branch-name>
Create/Modify/Add/commit/push normally.
When ready to merge to master, go to master and:
git merge <branch-name> --squash --no-commit
The option --squash
put together all the commits from the branch and creates just one commit. And the option --no-commit
dont apply the commit so you can review the changes.
Delete the local branch and the remote branch:
git branch -d <branch-name>
git push origin :<branch-name>
On master:
git pull
On the branch:
git merge master
Resolve conflicts if any and commit/push.
git log --since=2.weeks --author=jlara
git log --since="2014-03-18" --author=jlara --all-match
git log --since=3.weeks --author=jlara --author=rgutierrez --all-match
git log --author="rgutierrez" --pretty=format:"%h - %an, %ar : %s" --since=3.months
Complete Hash
git log --author="rgutierrez" --pretty=format:"%H - %an, %ar : %s" --since=3.months
git cherry-pick --no-commit <hash>
git cherry-pick -x <hash>
Clean untracked files:
git clean -f -d
Delete a branch locally:
git branch -d the_local_branch
Delete a branch remotelly:
git push origin :the_remote_branch
Remove any remote-tracking branches which no longer exist on the remote:
git fetch -p
Diff between commits
git diff hash1 hash2
Diff between commits (but just one file)
git diff hash1 hash2 <path-to-file>
What are the changes in commit?
git show hash
What are the files that changed in commit?
git show hash --name-only
To reset your local to an specific hash in a "HARD" way. That means destroying any local modification.
git reset --hard <hash>
Do not do this if you have uncommited work that you want to keep.
git stash
git stash pop
git stash list
git stash show -p
git stash show -p stash@{4}
You are the third result in Google when looking for watering in git 👍