FAQ

IndexTagsArchivesAbout
  • Pushing empty commits to remote

    2022-01-24

    Question I have pushed one commit to remote but now I realized that the commit message is not correct. I would like to change the commit message but AFAIK it is not possible. So i decided to create empty commit with correct message: git commit --allow-empty Are there any disadvantages/consequences of pushing empty commits? Is there any problem I might face in future because of this empty commit?? Answer One use of an empty commit would be to force a build to occur in an environment where builds are triggered whenever new commits are pushed.…

    #git

  • Converting a Pandas GroupBy output from Series to DataFrame

    2022-01-22

    Question I'm starting with input data like this df1 = pandas.DataFrame( { "Name" : ["Alice", "Bob", "Mallory", "Mallory", "Bob" , "Mallory"] , "City" : ["Seattle", "Seattle", "Portland", "Seattle", "Seattle", "Portland"] } ) Which when printed appears as this: City Name 0 Seattle Alice 1 Seattle Bob 2 Portland Mallory 3 Seattle Mallory 4 Seattle Bob 5 Portland Mallory Grouping is simple enough: g1 = df1.groupby( [ "Name", "City"] ).count() and printing yields a GroupBy object:…

    #python

  • How to grep commits based on a certain string?

    2022-01-21

    Question In a Git code repository I want to list all commits that contain a certain word. I tried this git log -p | grep --context=4 "word" but it does not necessarily give me back the filename (unless it's less that five lines away from the word I searched for. I also tried git grep "word" but it gives me only present files and not the history. How do I search the entire history so I can follow changes on a particular word?…

    #git

  • How do I find the next commit in Git? (child/children of ref)

    2022-01-19

    Question ref^ refers to the commit before ref. What about getting the commit after ref? For example, if I git checkout 12345, how do I check out the next commit? Yes, Git's a DAG node pointer struct tree whatever. How do I find the commit after this one? Answer To list all the commits, starting from the current one, and then its child, and so on - basically standard git log, but going the other way in time, use something like…

    #git

  • How do I properly force a Git push?

    2022-01-19

    Question I've set up a remote non-bare "main" repo and cloned it to my computer. I made some local changes, updated my local repository, and pushed the changes back to my remote repo. Things were fine up to that point. Now, I had to change something in the remote repo. Then I changed something in my local repo. I realized that the change to the remote repo was not needed. So I tried to git push from my local repo to my remote repo, but I got an error like:…

    #git

  • What are the differences between double-dot ".." and triple-dot "..." in Git commit ranges?

    2022-01-19

    Question Some Git commands take commit ranges and one valid syntax is to separate two commit names with two dots .., and another syntax uses three dots .... What are the differences between the two? Answer Using Commit Ranges with Git Log When you're using commit ranges like .. and ... with git log, the difference between them is that, for branches A and B, git log A..B will show you all of the commits that B has that A doesn't have, while…

    #git

  • Git keeps asking me for my ssh key passphrase

    2022-01-18

    Question I created keys as instructed in the github tutorial, registered them with github, and tried using ssh-agent explicitly — yet git continues to ask me for my passphrase every time I try to do a pull or a push. What could be the cause? Answer Once you have started the SSH agent with: eval $(ssh-agent) Do either: To add your private key to it: ssh-add This will ask you your passphrase just once, and then you should be allowed to push, provided that you uploaded the public key to Github.…

    #git

  • «
  • 151
  • 152
  • 153
  • 154
  • 155
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^