According to the documentation of GitVersion for GitFlow, the minor version of the develop branch should be bumped when a release branch is created.
As far as I understood it, this should happen automagically?
(https://gitversion.readthedocs.io/en/latest/git-branching-strategies/gitflow-examples/) - See Minor/Major release branches
I'm currently using GitVersion 3.6.5 (as this is the version installed with the VSTS GitVersion task)
I created a small test repository as follows:
git init
[master] touch helloworld.txt
[master] git add --all
[master] git commit -m "Added file"
[master] git tag 0.1.0
[master] git checkout -b develop
[develop] touch helloworld.txt
[develop] git add --all
[develop] git commit -m "updated file"
[develop] gitversion --> Reports 0.2.0.unstable.# (OK)
[develop] git checkout -b release/0.2.0
[release/0.2.0] touch helloworld.txt
[release/0.2.0] git add --all
[release/0.2.0] git commit -m "Updated file"
[release/0.2.0] gitversion --> Reports 0.2.0.beta.# (OK)
[release/0.2.0] git checkout develop
[develop] touch helloworld.txt
[develop] git add --all
[develop] git commit -m "updated file again"
[develop] gitversion --> Reports 0.2.0.unstable.# (WRONG)
That last gitversion command, i expected it to report 0.3.0.unstable.#, because there exists a release branch for 0.2.0
Why isn't develop reporting an increase in minor version after I created the release branch and committed to it?!
After testing the same flow with GitVersion 4.0.0-beta13, it correctly reports develop to be 0.3.0 instead of 0.2.0
Now i just need to figure out a way to incorporate 4.0.0 into our vsts build process
Edit:
Workaround for VSTS / TFS icm with GitVersion task:
https://github.com/GitTools/GitVersion/issues/1160#issuecomment-381517122
Related
Some articles mentions a command line option git subtree push-all to push for each subtree project to its own repository.
However, it seems that the latest git does not support such command.
FYI, I am using git on Windows.
What happened to git subtree push-all command and how can I push all subtree repositories at once?
In the following project
https://github.com/spark-jobserver/spark-jobserver,
we recently upgraded from 0.13.12 to 1.1.6.
In 0.13.12 we used to do sbt "testOnly *JobServerSpec" and tests cases for the specific class used to run but with 1.1.6, it is not the case anymore.
To reproduce the issue,
NOTE: If you get a Not in Gzip format exception, then in the project root, execute rm -rf **/target
clone the project, currently it is using 1.1.6.
git checkout d7e231ea4ee9981e49b411d09f132e396c901b98 will switch to a point before 1.1.6 was introduce
Execute sbt "testOnly *JobServerSpec", tests should be running
git checkout master to switch back to version with sbt 1.1.6
Execute sbt "testOnly *JobServerSpec"
It should not run any tests.
I'm new to git and would like to get started using bitbucket.org as a place to create a private repository. This can then be uploaded to the staging server using a service like ftploy.com as I understand.
I am following a tutorial on WPBeginner.com to set up a staging environment for my WordPress local website which I am developing. I set up git on the mac, ran git init on the theme folder and then added all the files using git add .
After that I made a first commit using git commit -m "message here" So far the process appeared to work. No feedback in the terminal though? I then added the line
git remote add origin https://bitbucketusername#bitbucket.org/bitbucketusername/repositoryname.git
Replacing bitbucketusername with mine and repository name with mine. Attempting to push the files to the bitbucket repository resulted in this error however:
error: --all can't be combined with refspecs
usage: git push [<options>] [<repository> [<refspec>...]]
-v, --verbose be more verbose
-q, --quiet be more quiet
--repo <repository> repository
--all push all refs
--mirror mirror all refs
--delete delete refs
--tags push tags (can't be used with --all or --mirror)
-n, --dry-run dry run
--porcelain machine-readable output
-f, --force force updates
--force-with-lease[=<refname>:<expect>]
require old value of ref to be at this value
--recurse-submodules[=<check>]
control recursive pushing of submodules
--thin use thin pack
--receive-pack <receive-pack>
receive pack program
--exec <receive-pack>
receive pack program
-u, --set-upstream set upstream for git pull/status
--progress force progress reporting
--prune prune locally removed refs
--no-verify bypass pre-push hook
--follow-tags push missing but relevant tags
If you have any thoughts on why this may be the case I would appreciate it
You should provide us the command you used to do your git push, but my guess is you did something like this:
git push --all origin master
As git is telling you, this can't be used that way. Here you are asking git to push everything to origin but then you specify a branch (the <refspec>), so it is confusing.
Either push all like this:
git push --all origin
or just your master branch like this:
git push origin master
I am using a WordPress directory struture similar to Mark Jaquith's WordPress Skeleton, which has WordPress in a separate directory from the content as a submodule:
/content
/wp
/local-config.php
/wp-config.php
/index.php
I also use git and post-receive hooks to push my code changes up to my live server. It all works great except for when I try to upgrade WordPress and push that up to the live server.
This is how I setup the repo on my local machine and the remote server:
Local Machine
cd /www
git init .
git submodule add git://github.com/WordPress/WordPress.git wp
git commit -m "Add Wordpress submodule."
cd wp
git checkout 3.5
After checking out the tag, I get a warning from git about being in a 'detached HEAD' state. Since I don't plan on making any commits to WordPress, I don't think that should be an issue.
cd ..
git commit -am "Checkout Wordpress 3.5"
Remote Server
git init --bare
cat > hooks/post-receive
#!/bin/sh
GIT_WORK_TREE=/home/public git checkout -f
chmod +x hooks/post-receive
git remote add web ssh://user#server/home/private/code/wordpress.git
git push web +master:refs/heads/master
I get this error:
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'ssh://userserver/home/private/code/wordpress.git'
After some googling, it looks like I can use this command to sync up the master branch up to the server (I have no idea how this works)
git push web +master:refs/heads/master
This doesn't help me though because I don't want to track master, I want to track a release tag, 3.5. Some more googling got me to this command:
git push web +3.5~0:refs/heads/master
To upgrade the submodule, I do this:
cd wp
git fetch && git fetch --tags
git checkout 3.5.1
git push web +3.5.1~0:refs/heads/master
Am I doing this correctly? All the tutorials I see for this just have git push web and they're done. Most don't even cover upgrading the submodule. This does work but I don't feel comfortable using this weird push syntax if I don't have to.
How do I push this detached HEAD state up to the server correctly?
I've also tried this using a branch with git checkout -b mywp 3.5 but when it comes time to upgrade, I don't know how to bring in the new 3.5.1 tag into my mywp branch.
Asked this on WP Answers, but it might be more appropriate here.
On the remote server try:
git submodule update --init --recursive
This will update all your submodules recursively
You can also issue:
git fetch --tags
This will update your local tags fetching updated list from the central remote repo.
I want to clone the latest stable version of WordPress from Github, via a shell script. It is simple to get the unstable master branch:
git clone git://github.com/WordPress/WordPress.git
But how can I get the highest numbered stable release via a script, not manually checking out the code. E.g., using deployment shell script or deployment tool such as Fabric.
Edit: I clarified the text to better indicate the intent that I meant how to do this from a script, not manually.
Clone from git and change to the WordPress directory
git clone git://github.com/WordPress/WordPress.git
cd WordPress
Then list out the branches..
git branch -r
This gives something like...
origin/1.5-branch
origin/2.0-branch
...
origin/3.4-branch
origin/HEAD -> origin/master
origin/master
Check out the branch you want...
git checkout 3.4-branch
Branch 3.4-branch set up to track remote branch 3.4-branch from origin.
Switched to a new branch '3.4-branch'
Here's what I actually ended up doing, which is included in a Fabric fabfile I have on Github:
git clone git://github.com/WordPress/WordPress.git .
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
It clones the repo like normal, then does some shell magic to find the latest tagged version of WordPress (Which is where the stable branches live.)
Can you try a git checkout master ?
git branch -r will show you all the remote branches
git checkout --track <local_branch> <remote>/<remote_branch> will setup a local branch that is tracking the remote branch in order to push or get new updates.
you can use this command after git clone
git checkout stable