Skip to content

Instantly share code, notes, and snippets.

@back-2-95
Last active February 5, 2023 07:51
Show Gist options
  • Save back-2-95/e23d1f9e1450d6b45e0ca190edfb986e to your computer and use it in GitHub Desktop.
Save back-2-95/e23d1f9e1450d6b45e0ca190edfb986e to your computer and use it in GitHub Desktop.
How to sync to other git repository in different system (Azure example)
GIT_REMOTE_AZURE := azure
GIT_REMOTE_AZURE_URL := REPO_IN_AZURE
GIT_REMOTE_AZURE_BRANCH := dev
GIT_REMOTE_AZURE_PUSH_BRANCH := dev-github
PHONY += git-add-remote
git-add-remote: ## Add Azure Git remote
$(call step,Add Azure Git remote...)
git remote add $(GIT_REMOTE_AZURE) $(GIT_REMOTE_AZURE_URL)
PHONY += git-show-remote
git-show-remote: ## Show all Git remotes
$(call step,Show all Git remotes...)
@git remote -v
PHONY += git-pull-from-azure
git-pull-from-azure: ## Git pull from Azure
$(call step,Git pull from Azure...)
git pull $(GIT_REMOTE_AZURE) $(GIT_REMOTE_AZURE_BRANCH)
PHONY += git-push-to-azure
git-push-to-azure: ## Git push to Azure
$(call step,Git push to Azure...)
git push $(GIT_REMOTE_AZURE) $(shell git rev-parse --abbrev-ref HEAD):$(shell git rev-parse --abbrev-ref HEAD)-github
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment