FAQ

IndexTagsArchivesAbout
  • Undo a git stash

    2022-11-28

    Question I just did a stash in a project that I haven't commit. Is there a way to go back to the state before I stashed? How could I do this? I've closed the terminal and my laptop is shut down. I've done some researched and it seems there's no way to do this. Answer You can just run: git stash pop and it will unstash your changes. If you want to preserve the state of files (staged vs.…

    #git

  • When does Git refresh the list of remote branches?

    2022-11-28

    Question Using git branch --all shows all remote and local branches. When does Git refresh this list? On pull/push? And how do I refresh it using Git Bash? Answer To update the local list of remote branches: git remote update origin --prune To show all local and remote branches that (local) Git knows about: git branch -a

    #git

  • How do I exit from the text window in Git?

    2022-11-27

    Question I am using Windows and before committing, Git wants me to enter a text message and a new text window appears. How can I exit from this? I am trying to learn Git. So, a little help will be highly appreciated. Answer Since you are learning Git, know that this has little to do with git but with the text editor configured for use. In vim, you can press i to start entering text and save by pressing esc and :wq and enter, this will commit with the message you typed.…

    #git

  • When doing a 'git push', what does '--set-upstream' do?

    2022-11-27

    Question What does git --set-upstream do? I tried to understand it by reading the git manual, but I didn't quite get it. Answer To avoid confusion, recent versions of git deprecate this somewhat ambiguous --set-upstream option in favor of a more verbose --set-upstream-to option with identical syntax and behavior. [ Reference ] git branch --set-upstream-to <remote-branch> sets the default remote branch for the current local branch. Any future git pull command (with the current local branch checked-out), will attempt to bring in commits from the <remote-branch> into the current local branch.…

    #git

  • What are the differences between "git commit" and "git push"?

    2022-11-23

    Question In a Git tutorial I'm going through, git commit is used to store the changes you've made. What is git push used for then? Answer Basically, git commit "records changes to the repository" while git push "updates remote refs along with associated objects". So the first one is used in connection with your local repository, while the latter one is used to interact with a remote repository. Here is a nice picture from Oliver Steele, that explains the Git model and the commands:…

    #git

  • How can I rename a git stash?

    2022-11-22

    Question I have a stash with an incorrect name. I would like to fix the name so it's accurate. How can I rename a stash? Answer Let's assume your stash list looks like this: $ git stash list stash@{0}: WIP on master: Add some very important feature stash@{1}: WIP on master: Fix some silly bug First, you must remove stash entry which you want to rename: $ git stash drop stash@{1} Dropped stash@{1} (af8fdeee49a03d1b4609f294635e7f0d622e03db) Now just add it again with new message using sha of commit returned after dropping:…

    #git

  • Re-doing a reverted merge in Git

    2022-11-22

    Question I have run into a bit of a problem here: I had a problem-specific branch 28s in Git, that I merged in the general develop branch. Turns out I had done it too fast, so I used git-revert to undo the merge. Now, however, the time has come to merge 28s into develop, but git-merge command sees the original merge, and happily announces that all is well and branches have been already merged.…

    #git

  • «
  • 66
  • 67
  • 68
  • 69
  • 70
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^