How do I add a tag to a Github commit? - github

When making a GitHub commit, how do I tag it using the git command-line options before pushing it to remote repo?
Can something like this be done?
git commit -m 'first commit' -tag -a v0.0.1 -m "1st release"

AFAIK, you cannot commit & tag in one command.
git commit -m "prepare for v1.0.0 release"
git tag v1.0.0
git push origin master --tags
All you can do is connect commands via &&:
git commit -m "prepare for v1.0.0 release" && git tag v1.0.0 && git push origin master --tags

Related

However to retrieve a missing commit after git merge

what is correct steps for me to merge one branch to my local feature branch? I use merge command . however, after merging, one local commit does not display for some reason but I am able to retrieve the hex from GitHub.
git checkout -b feature/local
# make change
git add <file>
git commit -m "file commit message"
git push
git checkout feature/working_parent
git pull
git checkout feature/local
git merge feature/working_parent
git push
the commit "file commit message" does not apply on feature/local anymore

How to update code in gitlab

My team committed code to gitlab repository and I need to take those updates. I already clone the project into my local directory but didn't take update before.
For taking update what commands need to run. I already tried pull command and it shows the changed file details but that changes are not applying to the project. For apply the changes any new command needs to run again?
Run following commands for taking the update:
git fetch && git checkout master
git pull
git config --global user.name "demo"
git config --global user.email "demo#gmail.com"
Create a new repository:
git clone https://gitlab.com/demo_test.git
cd demo_test
git switch -c main
touch README.md
git add README.md
git commit -m "add README"
git push -u origin main
Push an existing folder:
cd existing_folder
git init --initial-branch=main
git remote add origin https://gitlab.com/demo_test.git
git add .
git commit -m "Initial commit"
git push -u origin main
Push an existing Git repository:
cd existing_repo
git remote rename origin old-origin
git remote add origin https://gitlab.com/demo_test.git
git push -u origin --all
git push -u origin --tags

Error Deploying Artifact to Github from VSTS

I am trying to build maven project in VSTS using hosted agent.
I want to deploy my artifact to github. task i am using is Powershell. i am getting error "There is no tracking information for the current branch".
but artifcat are deploying to github, But Build Defination is failing.
If the github repo is not empty and you want to keep the commit histories, you can use the script as below:
cd $(Build.ArtifactStagingDirectory)
git init
git config --global user.name name
git config --global user.email ***#gmail.com
git add .
git commit -m "update"
git remote add origin https://username:password#github.com/username/reponame -f
git checkout -b temp
git checkout master
git reset --hard origin/master
git merge temp -X theirs --allow-unrelated-histories
git push -u origin master
If the github repo is empty or you don’t need to keep the commit histories, you can use the script as below:
cd $(Build.ArtifactStagingDirectory)
git init
git config --global user.name name
git config --global user.email ***#gmail.com
git add .
git commit -m "update"
git remote add origin https://username:password#github.com/username/reponame -f
git push -f origin master
And deselect Fail on Standard Error option:

Github - How to update my own repository?

I have a repository in my Github, and I cloned it on my desktop. Then I did some work in the folder. How do I commit those changes to my repository?
below code is right, but don't forget to add remote address to key "origin".
git remote add origin <YOUR_REPOSITORY_PATH>
git add .
git commit -m 'some change'
git push -u origin master
-u – sets repo branch as defaults, so then you can push, just git push
May
git add .
git commit -m "my changes"
git push origin master

How to push on my development branch on Github

I get an issue when I try to push on my development branch on Github. Actually, I forked the microscopejs repository to update some files...
Command :
git clone https://github.com/tonymx227/microscopejs.git
git add remote upstream https://github.com/tonymx227/microscopejs.git
git fetch upstream
// I updated some files using Sublime Text 2 here
git add . -A
git commit -m 'test'
git push origin development
Issue :
error: src refspec development does not match any.
error: failed to push some refs to 'https://github.com/tonymx227/microscopejs.git'
You haven't create a local development branch.
You only have the remote tracking branch origin/development after your clone.
Do first a:
git checkout -b development origin/development
Then:
git add . -A
git commit -m 'test'
git push -u origin development
Note: you don't need the git remote add upstream step.