

- What is git bash vs gitcmd how to#
- What is git bash vs gitcmd install#
- What is git bash vs gitcmd code#
I fixed the Python indentation since that's important.

Copied out of notepad++ and still stripped indentation. A pox on the forum's implementation of clipboard paste. So, I caved and went to my old mainstay of C# for calling the git scripts and passing that information to a Python script that updates a version.h file (similar to the solution I linked to in my previous post). I then tried testing calling git from a Python script and ended up getting odd additions to the output like "b'MyTagHash'" instead of a clean "MyTagHash" as expected. I ran into that same problem while testing it out as a prebuild step set up from within the IDE. There will be a warning if the file is in your project (like it is in ours) since it won't exist in a fresh clone, but only the first time. gitignore, and never committed, but new developers can still clone the repo and have the file created upon first build. Cheers! UPDATE: I edited the above so the version.h file would get 'touched' before running. I hope this is helpful to others, as it has solved the issues we had with getting a consistent build version approach regardless of development platform (Mac and Windows) and with minimal setup on the part of the developer. We use this to mark builds with the current version, as well as discern whether or not this is a release build based on our branching approach (search web for "A successful Git branching model" since I can't add the URL here). This will write the defines each time the build runs, keeping GIT_TAG, GIT_BRANCH, and GIT_COUNT up to date. /inc relative path to point to the folder you used in step 1): In the project under "Important Files" open the Makefile and edit the build-pre step to look like this (this is just a subset of the makefile since other targets in your may differ. rev-list HEAD -count`Įcho " * Populated by gitVersion.sh at project root"Įcho "#define GIT_BRANCH "\"$GIT_BRANCH\"Ĥ. git folder, or the root of the repository, so you may need to adjust the path: #!/bin/bash This assumes a certain folder layout as to the location of the. Create a shell script gitVersion.sh at the root folder of the project (the folder will also contain the 'Makefile'), containing the following, or using whatever calls you wish to use to inject into the project. Create an empty header file version.h in a place conveniently accessible, or where you keep other header files. The option you want says "Use Git and optional Unix tools.".
What is git bash vs gitcmd install#
If you are using Windows, install Git for Windows (cannot embed the URL it looks like) with the third option when prompted "How would you like to use Git.". This required nothing fancy in the build configuration at all. How would you recommend accommodating the above with something that works as well on Windows as it does on UNIX, or simply conditionally calls one script or the other depending on dev environment? Thanks all! Furthermore, I have a separate build configuration for Windows since it requires this special treatment, but that is obviously not sustainable long-term as configuration options change.
What is git bash vs gitcmd how to#
I know the Windows "FOR" command can do something analogous to the backticks, and I have a suspicion the MPLAB X pre-step operation is the place to call a batch file, but I don't know how to have it set vars which could then go into the aforementioned gcc command line options. I had thought of doing a batch file, but I'm not a Windows expert so I don't know how to translate the above into 'environment variables' I could pass into gcc. I want something simple that works 'out of the box' without a developer having to have anything special installed except for Git with command line support.
What is git bash vs gitcmd code#
rev-list HEAD -count`" Pretty simple, just gives us GIT_TAG, GIT_BRANCH, and GIT_COUNT we can use in code as if they were preprocessor defines.

rev-parse -abbrev-ref HEAD`" -DGIT_COUNT="`git -git-dir=./././.git -work-tree=. describe -always -tags`" -DGIT_BRANCH="`git -git-dir=./././.git -work-tree=. This is relatively simple on a UNIX (Mac) system using build configuration "Additional options" under the XC16 Global Options for xc16-gcc, like so: -DGIT_TAG="`git -git-dir=./././.git -work-tree=. Hi all, We use git for version control, and metadata about the current commit/branch/count in code to identify a given build. Pre-build step for build identification in code via SCM (Git) metadata
