FAQ

IndexTagsArchivesAbout
  • git push --force-with-lease vs. --force

    2022-06-12

    Question I am trying to understand the difference between git push --force and git push --force-with-lease My guess is that the latter only pushes to the remote if the remote has commits that the local branch doesn't have? Answer force overwrites a remote branch with your local branch. --force-with-lease is a safer option that will not overwrite any work on the remote branch if more commits were added to the remote branch (by another team-member or coworker or what have you).…

    #git

  • How to list branches that contain a given commit?

    2022-06-12

    Question How can I query git to find out which branches contain a given commit? gitk will usually list the branches, unless there are too many, in which case it just says "many (38)" or something like that. I need to know the full list, or at least whether certain branches contain the commit. Answer From the git-branch manual page: git branch --contains <commit> Only list branches which contain the specified commit (HEAD if not specified).…

    #git

  • Synchronizing a local Git repository with a remote one

    2022-06-12

    Question I want to synchronize my local repository with a remote one so that my local repository becomes a 100% copy of the remote one - meaning that if certain files differ in these repositories, we override the local ones with the remote ones, and if there are files in local repositories that do not exist in the remote, the local files get removed. Is there any way to achieve that other than by doing a fresh clone of remote repository?…

    #git

  • Git - remote: Repository not found

    2022-06-11

    Question I have SourceTree with local working copy. And all operations work good, I can simple fetch, push, pull and etc via SourceTree. I just needed to make force push which does not exist in SourceTree. I opened terminal made git push -f remote: Repository not found. fatal: repository 'https://github.com/MyRepo/project.git/' not found I am not sure what can be an issue. Answer Remove all the github.com credential details from the system.…

    #git

  • How to change my Git username in terminal?

    2022-06-11

    Question I was pushing and pulling from git in Terminal then I changed my username on github.com. I went to push some changes and it couldn't push because it was still recognizing my old username.. How do I change/update my username on git in terminal? Answer In your terminal, navigate to the repo you want to make the changes in. Execute git config --list to check current username & email in your local repo.…

    #git

  • How can I copy the content of a branch to a new local branch?

    2022-06-10

    Question I have worked on a local branch and also pushed the changes to remote. I want to revert the changes on that branch and do something else on it, but I don't want to lose the work completely. I was thinking of something like create a new branch locally and copy the old branch there, then I can revert the changes and continue working on the old branch. Is there a better way than this maybe?…

    #git

  • Remote origin already exists on 'git push' to a new repository

    2022-06-09

    Question I have my project on GitHub at some location, git@github.com:myname/oldrep.git. Now I want to push all my code to a new repository at some other location, git@github.com:newname/newrep.git. I used the command: git remote add origin git@github.com:myname/oldrep.git but I am receiving this: fatal: remote origin already exists. Answer You are getting this error because "origin" is not available. "origin" is a convention not part of the command. "origin" is the local name of the remote repository.…

    #git

  • «
  • 111
  • 112
  • 113
  • 114
  • 115
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^