git remote -v
git pull origin
git log type
q on the terminal.
This can be used when you are updating your local repository with the remote one and there are conflicts. You can stash, pull and then commit or drop your changes.
git stash #to save your local changes git drop #to drop your local changes git pop #to get back your local changes
git remote add <remote nickname> https://github.com/user/repository
git rm -r one-of-the-directories git commit -m "Remove duplicated directory" git push origin <your-git-branch> #(typically 'master', but not always)
Useful to solve conflicts
git rm -r --cached myFolder
step by step:
git branch patch-1 git checkout patch-1
Or in a one liner:
git checkout -b patch-1
You are on your local repository and you want to fetch a remote branch.
git checkout --track origin/patch-1
A branch is for work. A tag marks a place in time. By tagging each branch merge we can resurrect a branch if that is needed.
git checkout <feature-branch> git pull origin # Making sure it's last version of feature branch git checkout <release-branch> git pull origin git merge --no-ff <feature-branch> git push origin master git tag -a <tag name> -m "Merge <feature-branch> into <release-branch>" git push --tags origin git branch -d <feature-branch> git push origin :<feature-branch> #to push deleted bransh to remote
In your workflow you’ll often need to checkout and fetch branches from a remote repository to do code review of your colleagues for example.
git checkout -b <local-branch> <remote-branch> git fetch
So for example I have a branch called feature/abc remotely
git checkout -b feature/abc origin/feature/abc
There is also a shortcut for this command:
git checkout --track -b <remote-branch>
git fetch git branch -r git checkout <branch_name>
Commits are identified by a special number, a commit hash usually looking like
860652a4ab3749a72401b2ceaacf68b27afbc404 it can also be identified with the first 7 numbers like
For a merge commit you need to use:
git revert 860652a -m 1
Which will revert the merge commit
860652a to the previous commit with the