Skipping builds in codeship - codeship

I am reading the Codeship documentation about skipping builds.
I am struggling to understand the correct format when doing a commit. I want to skip builds because I don't want to go over the 100 free monthly builds. I will run the tests myself instead.
Codeship says that I can --skip-ci or [skip ci] to the commit message. I have tried formats like:
git commit -m "My message" --skip-ci
git commit -m "My message" [skip ci]
git commit -m -skip-ci "My message"
None of these work. What is the right format?

The correct format is to add the method to the string itself:
git commit -m "My message --skip-ci"
or:
git commit -m "My message [skip ci]"

I use a couple of handy aliases, extended from Oh-My-Zsh. My workflow has been improved by adding these to my system;
Create a WIP commit:
alias gwip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip--"'
And then create a WIP commit without running CI:
alias gwipskip='git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit -m "--wip-- --skip-ci"'

Related

Create a 'release' entry in Github

I'd like to create a release entry on my Github project.
I tried this from the cli
git commit -a -m 123
git tag -a "123" -m "msg"
git push
This commits the files but I don't see a release tab entry - nor do I see the tag.
Thanks.
By default, the git push command doesn’t transfer tags to remote servers. You will have to explicitly push tags to a shared server after you have created them.
From Git Basics - Tagging
No need for the double quotes on git tag - git tag -a 123 -m "msg"
Use the --tags flag on push - git push --tags

How to add/update files in git repository from Azure DevOps Pipeline Dynamics 365 CE

Short Version
When a build pipeline is triggered, one of the build pipeline task will get the latest files and it has to be added/updated in the git repository of current running pipeline. I tried to do it by using command line task but its failing as not git repository
fatal: not a git repository (or any of the parent directories): .git
Long Version
I m tried to achieve solution pack and unpack process for dynamics 365 instance. So the build pipeline have the following tasks
Export solution from Dynamics 365 and store it in $(build.binariesdirectory)
Unpack the solution zip file and store in $(Build.Repository.LocalPath) i.e., adding/updating existing files
Command line task to commit and push the files to current pipeline repository
ECHO "Setting git config..."
git config --global user.email "xxx#xyz.com"
git config --global user.name "Admin"
ECHO "CHECK GIT STATUS..."
git status
ECHO "GIT ADD..."
git add -A
ECHO "CHECK GIT STATUS..."
git status
ECHO "Commiting the changes..."
git commit -m "Latest Customizations updated"
ECHO "Pushing the changes..."
git push -u origin master
ECHO "Customization Committed Successfully"
Updated
If a pipeline is created with 2 command line task i.e. one to create a random file in the Build.Sourcedirectory and another to commit the changes, then the git commit and push commands are working.
But if we add other tasks (such as unzip files in Build.Sourcedirectory directory) before the command line task then getting error as not a repository.
If you see the below screenshot, in the checkout phase the git repo is cloned to D:\a\1\s
And below screenshot is from command line task, where the current working directory is same as the checkout task (i.e., D:\a\1\s) and we can see that the ".git" folder is present so the current directory has local repository in it, but still getting error as fatal: not a git repository
Am I missing anything here?
By default the source files are checked out to the Build.SourcesDirectory (e.g : Directory: D:\a\1\s), it can be considered as a temporary git repository.
According to the error message, it appears that the working directory of the command line task is not under the Build.SourcesDirectory and you did't git checkout again to that working directory.
So, please try unpack the solution zip file and store in Build.SourcesDirectory, then run below Command line to push the commits (it works for me):
ECHO "Setting git config..."
git config --global user.email "xxx#xyz.com"
git config --global user.name "Admin"
ECHO "CHECK GIT STATUS..."
git status
git checkout -b master
ECHO "GIT ADD..."
git add -A
ECHO "CHECK GIT STATUS..."
git status
ECHO "Commiting the changes..."
git commit -m "Latest Customizations updated"
ECHO "Pushing the changes..."
git push -u origin master
ECHO "Customization Committed Successfully"
Please note that you need to Grant version control permissions to the build service and enable Allow scripts to access the system token.

Rebase the second commit to master

I have edited some files in the repo and now it looks like the following:
history1 --> history2 --> ... --> master
\
\
my commit 1 --> my commit 2
But actually 'my commit 2' should not be on top of 'my commit 1', that's a mistake... How do I only rebase 'my commit 2' to master in mercury?
history1 --> history2 --> ... --> master
\ \
\ \
my commit 1 my commit 2
I am asking how to do this in Mercurial not git.
Make sure you have the rebase extension enabled in your hgrc file. Then:
$ hg rebase -r <commit ID of my commit 2> -d master
See "hg help rebase" for more details.
From a different post:
You can cherry-pick XX to master.
git checkout master
git cherry-pick <commit ID of XX>
And remove the last commit from the feature branch with git reset.
git checkout Feature-branch
git reset --hard HEAD^

Cannot push onto github

I want to pysh my project to a github repository called luna.git:
I followed the instructions
echo “# luna” >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/raouiyounes/luna.git
git push -u origin master
But I get this error
error: src refspec master does not match any.
error: impossible de pousser des références vers ‘https://github.com/raouiyounes/luna.git’
Maybe you just need to commit.
Try this:
git add .
git commit -m "initial commit"
git push origin master
You can do :
git push origin HEAD:branch-name

How to Commit in github?

i am getting error sh.exe: notepad: command not found please short out my problem
Thanks
For the commit to GitHub part, you need to add (if you have created an empty yourRepo on GitHub):
git config user.name yourGitHubUsername
git config user.email yourGitHubEmail
git add .
git commit -m "First commit"
git remote add origin https://yourAccount#github.com/yourAccount/yourRepo
git push -u origin master
If that fails because GitHub already created one commit when you initialized your "empty" repo (it can add by default a README.md and a .gitignore), do a:
git pull --rebase origin master
git push -u origin master
If you really have to call notepad from a mingw session, you can use this wrapper:
#!/bin/sh
'C:/Program Files (x86)/Notepad++/notepad++.exe' -multiInst -notabbar \
-nosession -noPlugin "$(cygpath -w "$*")"
But remember you can use msysgit from a DOS session as well.
Seps:
1.git init
2. git status
3. git add .
4. git commit -a
5. git status