menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Git: using...
source image

Dev

2w

read

377

img
dot

Image Credit: Dev

Git: using --interactive mode to commit specific parts of a file

  • To commit specific parts of a file, use --interactive mode with git add.
  • Identify untracked file with git status and make git track it with git add -N command.
  • Use git add --interactive to customize commits on a line-by-line basis.
  • Enter 'patch' in the prompt to access interactive mode.
  • Select the file and choose specific lines to include in the commit.
  • Edit the contents in the text editor to customize commit contents.
  • Review changes with 'diff' and exit interactive mode when done.
  • Commit the selected changes using git commit -m command.
  • For remaining content, stage and commit separately using git add and git commit commands.
  • Keep track of commits with git log for a clear listing.

Read Full Article

like

22 Likes

For uninterrupted reading, download the app