Set local master the same as remote repository
Setting your branch to exactly match the remote branch can be done in two steps:
git fetch origin
git reset --hard origin/master
Related cards:
Create local repository and push to remote
Create Local Repository
- Download GitHub for Windows or use something similar, which includes a shell
- Launch Git Shell
- In the shell, navigate to the directory with
cd
-
git init
to create a local repository
...
Overwrite local staging or master with remote
Must use Git Bash.
To overwrite local master with remote:
git checkout master
git fetch --all
git reset --hard origin/master
To overwrite local main with remote "upstream"
git fetch upstream
git reset --hard upstream/mai...
Pull from Remote Repository
When other made changes and push those changes to remote repository, we can pull those changes to our local repository. However, if a local file will be overwritten with the pull, an error will occur: “Your local changes to the following files wo...
Deprecated - How to Remove Unwanted Files Before Merging an Upstream Branch to Master and Staging
Deprecated method. Use this instead. See also [this](https://makandracards.com/kiat_git/485037-how-to-r...
How to Update a Forked Repository from Upstream
Scenario
2 to 3 remote repositories in GitHub and 2 local repositories:
- [GitHub] Go to an owner repository (eg OpenMage).
- [GitHub] Fork owner's repository (from item 1).
- [GitHub or BitBucket] Our application with custom code.
- [Loca...
prod log: code deployment
"git is not a deployment tool, so don't do that"
http://gitolite.com/deploy.html
Set up SSH keys
The following setup the SSH for root so we can use SSH to bitbucket when login as root.
...
fatal: The remote end hung up unexpectedly fatal: early EOF fatal: index-pack failed
$ git fetch origin
remote: Counting objects: 201, done.
remote: Compressing objects: 100% (178/178), done.
fatal: The remote end hung up unexpectedlyKiB | 10.00 KiB/s
fatal: early EOF
fatal: index-pack failed
To resolve, do
$ git co...
How to create new repo on existing code and link to remote
I wrote some code in some files in a folder called AA. I have a repo in remote in Bitbucket. Here're the steps to link my local to remote using TortoiseGit:
- Create a repo for the folder AA: Navigate to the folder in windows explorer and ri...
Using Bitbucket for Automated Deployments
See also:
- http://jonathannicol.com/blog/2013/11/19/automated-git-deployments-from-bitbucket/
- http://symmetrycode.com/super-easy-deployment-with-git-and-bitbucket/
Bitbucket provides git hooks that can be used for code deployment. Code deploy...
Apply Upstream Pull Request to Local
There are 2 ways:
Using GitHub CLI gh
If local branch has the same base branch as upstream:
gh PR checkout {PR#}
Using Patch Files
If local branch diverges from the branch in which the PR is based, then we need to create patc...