git remote add mycolleague https://github.com/mycolleague/project.git
git push mycolleague pr-449:{his branch name - remote branch}
git commit --allow-empty -m "Trigger Build"
git update-index --assume-unchanged config/database.yml
- To undo this setting:
git update-index --no-assume-unchanged config/database.yml
I pulled the code, there was a conflict in the merge and I want to undo the pull (to delete the local branch)
git merge --abort
I have made some local changes in a branch and want to transfer that to another branch, before commit them
Use git stash
when you want to record the current state of the working directory and the index, but want to go back to a clean working directory. The command saves your local modifications away and reverts the working directory to match the HEAD
commit.
git stash
git checkout another-branch
git stash --apply
git branch -D 'branch_name'
git push origin --delete 'branch_name'
git remote add upstream <remote_reporitory_url>
git fetch upstream <remote_branch>:<local_branch>
git fetch upstream pull/<id>/head:<local_branch>
git checkout <local_branch>
git pull upstream pull/<id>/head
git reset HEAD~1
git rm -r --cached .
git add .
git commit -am "Remove ignored files"
- Find the commit hash with git log command
- Go to the desired branch to do this commit
git cherry-pick <hash_commit>
git add .
git commit
git archive --format zip --output <file_name>.zip master