Giter VIP home page Giter VIP logo

Comments (12)

SimeonGerginov avatar SimeonGerginov commented on August 16, 2024 1

Yes option 2 looks very good, so I think this will be the approach we take.

from dscr-for-vmware.

rockaut avatar rockaut commented on August 16, 2024

i support that too.

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on August 16, 2024

Yes, I also think it is a good idea to have it in the project. We will start working on it.

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on August 16, 2024

Could you please provide more information on the requested template - the template should contain only the line specified above or to be like this for example:

 git add .
 git commit -s -m "<commit message>"
 git push origin <branch>

from dscr-for-vmware.

lucdekens avatar lucdekens commented on August 16, 2024

I was thinking of adding the following to the .gitconfig file

[commit]
    template = ~/.gitmessage

And then in ~/.gitmessage

Signed-off-by: Your Name <[email protected]>

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on August 16, 2024

Ok, looks good this way !

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on August 16, 2024

So the content of ~/.gitmessage should look like this ?

 Signed-off-by: git config --global user.name git config --global user.email

from dscr-for-vmware.

lucdekens avatar lucdekens commented on August 16, 2024

There are a couple of ways of doing this.

  1. When you are using VSC it is a preference, nothing required in git.
{
    "git.alwaysSignOff": true
}
  1. When you are not using VSC, you can use a git hook, which can be a PowerShell script.
    These 2 files go into the .git\hooks folder.

The .sh to call PowerShell, named prepare-commit-msg

#!/bin/sh
c:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -ExecutionPolicy Bypass -Command '.\.git\hooks\prepare-commit-msg.ps1'

and a .ps1 script, named prepare-commit-msg.ps1.

$commitText = @'
<Your commit title>

<Your commit details>

Date: $(Get-Date -Format 'ddd dd/MM/yyyy')
Time: $(Get-Date -Format 'HH:mm')

Signed-off-by: $($env:GIT_AUTHOR_NAME) <$($env:GIT_AUTHOR_EMAIL)>
'@

Set-Content -Path .\.git\COMMIT_EDITMSG -Value ($ExecutionContext.InvokeCommand.ExpandString($commitText))
  1. Also in git, you can use the git config option commit.template. This config option points to a template file. Both files are located in the .git folder in the repo.

File .git\config

[commit]
	template = ./.git/templatefile.txt

The template itself, named templatefile.txt here. This contains static text (I have not found how to introduce git environment variables in here).

<Enter commit message>

<Enter commit details>

Signed-off-by: LucD <[email protected]>

In summary, option 1) is the easiest, but requires you use VSC.
Option 2) and 3) are editor independent, where I personally prefer option 2) since it can be customised.

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on August 16, 2024

Another solution to the problem is to use the following template:

git add .
git commit -s -m <Your commit message>
git push origin <Your working branch>

We can add the template to the repository for reference and this way we can avoid using hooks.
What do you think ?

from dscr-for-vmware.

lucdekens avatar lucdekens commented on August 16, 2024

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on August 16, 2024

Ok then. I will soon add it to the repository with instructions on how to use it.

from dscr-for-vmware.

SimeonGerginov avatar SimeonGerginov commented on August 16, 2024

Added the git template to the repository. Closing the issue.

from dscr-for-vmware.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.