FAQ

IndexTagsArchivesAbout
  • Unable to show a Git tree in terminal

    2022-08-18

    Question Killswitchcollective.com's old article, 30 June 2009, has the following inputs and outputs git co master git merge [your_branch] git push upstream A-B-C-D-E A-B-C-D-E-F-G \ —-> your branch C-D-E G I am interested how you get the tree like-view of commits in your terminal without using Gitk or Gitx in OS/X. How can you get the tree-like view of commits in terminal? Answer How can you get the tree-like view of commits in terminal?…

    #git

  • .gitignore exclude folder but include specific subfolder

    2022-08-17

    Question I have a folder application/, which I add to the .gitignore. Inside the application/-folder there is a folder application/language/gr. How can I include this folder? I've tried this: application/ !application/language/gr/ Answer If you exclude application/, then everything under it will always be excluded (even if some later negative exclusion pattern (“unignore”) might match something under application/). To do what you want, you have to “unignore” every parent directory of anything that you want to “unignore”.…

    #git

  • How do I reset or revert a file to a specific revision?

    2022-08-17

    Question How do I revert a modified file to its previous revision at a specific commit hash (which I determined via git log and git diff)? Answer Assuming the hash of the commit you want is c5f567: git checkout c5f567 -- file1/to/restore file2/to/restore The git checkout man page gives more information. If you want to revert to the commit before c5f567, append ~1 (where 1 is the number of commits you want to go back, it can be anything):…

    #git

  • How to read the output from git diff?

    2022-08-17

    Question The man page for git-diff is rather long, and explains many cases which don't seem to be necessary for a beginner. For example: git diff origin/master Answer Lets take a look at example advanced diff from git history (in commit 1088261f in git.git repository): diff --git a/builtin-http-fetch.c b/http-fetch.c similarity index 95% rename from builtin-http-fetch.c rename to http-fetch.c index f3e63d7..e8f44ba 100644 --- a/builtin-http-fetch.c +++ b/http-fetch.c @@ -1,8 +1,9 @@ #include "…

    #git

  • Is there a way to cause git-reflog to show a date alongside each entry?

    2022-08-17

    Question The git-reflog command doesn't by default show a date alongside each entry, which strikes me as a strange oversight; I think this would be very helpful. Are there any command-line options, or other tweaks, which can be employed to cause it to show when each reflog entry was added? The manpage isn't forthcoming... Answer Per the man page, you can use git log options, e.g., git reflog --pretty=short git reflog –date=iso

    #git

  • Selecting multiple columns in a Pandas dataframe

    2022-08-17

    Question How do I select columns a and b from df, and save them into a new dataframe df1? index a b c 1 2 3 4 2 3 4 5 Unsuccessful attempt: df1 = df['a':'b'] df1 = df.ix[:, 'a':'b'] Answer The column names (which are strings) cannot be sliced in the manner you tried. Here you have a couple of options. If you know from context which variables you want to slice out, you can just return a view of only those columns by passing a list into the __getitem__ syntax (the []'s).…

    #python

  • hat's the difference between Git Revert, Checkout and Reset?

    2022-08-16

    Question I am trying to learn how to restore or rollback files and projects to a prior state, and don't understand the difference between git revert, checkout, and reset. Why are there 3 different commands for seemingly the same purpose, and when should someone choose one over the other? Answer These three commands have entirely different purposes. They are not even remotely similar. git revert This command creates a new commit that undoes the changes from a previous commit.…

    #git

  • «
  • 91
  • 92
  • 93
  • 94
  • 95
  • »

©2023 hugo-notepadium-mod

CC BY-NC-SA 4.0 | RSS

Powered by Hugo and the Notepadium-mod

^ TOP ^